Skip to content

Commit

Permalink
File search also possile within source when file is shown and searcha…
Browse files Browse the repository at this point in the history
…ble.
  • Loading branch information
mkalus committed Sep 16, 2015
1 parent 89a0b19 commit 13753b9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 13 deletions.
14 changes: 1 addition & 13 deletions src/main/webapp/WEB-INF/templates/file/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,7 @@ <h4 class="sg-data-header">
</div>
</div>

<form class="sg-margin-top sg-simple-form" action="#" method="get" th:unless="${#strings.isEmpty(entity.fullText)}" th:action="@{/search/in_document}" th:attr="data-id=${'s-' + entity.uid + '-content'}">
<div class="form-group">
<label for="s" th:for="${'s-' + entity.uid}" th:text="#{field.searchWithinDocument}">Search within full text of document</label>
<input type="text" class="form-control" id="s" th:id="${'s-' + entity.uid}" name="s" />
</div>

<input type="hidden" name="id" th:value="${entity.uid}" />
<div class="sg-margin-top-sm">
<button type="submit" class="btn btn-default" th:text="#{Search}">Search</button>
</div>
</form>

<div id="s-x" th:id="${'s-' + entity.uid + '-content'}"></div>
<div th:replace="partials/search :: withinFile (file=${entity}, uid=${entity.uid})"></div>

<div th:if="${entity.fileIdentifier}" class="sg-margin-top sg-margin-bottom">
<div th:if="${#strings.startsWith(entity.mimeType,'image/')}">
Expand Down
30 changes: 30 additions & 0 deletions src/main/webapp/WEB-INF/templates/partials/search.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!doctype html>
<html xmlns:th="http://www.thymeleaf.org" th:lang="${#locale.language}">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Segrada</title>
<div th:include="partials/common :: head" th:remove="tag"></div>
</head>

<body>
<h1>Search within file partial</h1>

<div th:fragment="withinFile (file, uid)" th:unless="${#strings.isEmpty(file.fullText)}" class="sg-search-within-file">
<form class="sg-margin-top sg-simple-form" action="#" method="get" th:action="@{/search/in_document}" th:attr="data-id=${'s-' + uid + '-' + file.uid + '-content'}">
<div class="form-group">
<label for="s" th:for="${'s-' + uid + '-' + file.uid}" th:text="#{field.searchWithinDocument}">Search within full text of document</label>
<input type="text" class="form-control" id="s" th:id="${'s-' + uid + '-' + file.uid}" name="s" />
</div>

<input type="hidden" name="id" th:value="${file.uid}" />
<div class="sg-margin-top-sm">
<button type="submit" class="btn btn-default" th:text="#{Search}">Search</button>
</div>
</form>

<div id="s-x" th:id="${'s-' + uid + '-' + file.uid + '-content'}"></div>
</div>

</body>
</html>
2 changes: 2 additions & 0 deletions src/main/webapp/WEB-INF/templates/source/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ <h4 class="sg-data-header">

<div class="sg-description well well-sm" th:unless="${#strings.isEmpty(entity.description)}"><th:markup text="${entity.description}" markup="${entity.descriptionMarkup}" /></div>

<div th:replace="partials/search :: withinFile (file=${pdfFile}, uid=${entity.uid})" th:if="${pdfFile}"></div>

<div th:if="${pdfFile}" class="sg-margin-top sg-margin-bottom">
<iframe src="../../../js/pdfjs/web/viewer.html" th:src="@{/js/pdfjs/web/viewer.html(file=@{/file/file/{uid}(uid=${pdfFile.uid})})}" width="100%" height="400"></iframe>
</div>
Expand Down

0 comments on commit 13753b9

Please sign in to comment.