Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 1 | % if (param 'q') { |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 2 | %= search begin |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 3 | |
| 4 | % unless (param 'snippet') { |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 5 | <div style="clear: both"> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 6 | % my $url = url_with->query(['p' => '{page}']); |
| 7 | % my $pages = (stash('search.totalResults') / (stash('search.itemsPerPage') || 1)); |
| 8 | % $pages = $pages < 0 ? 0 : $pages; |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 9 | <div id="pagination"><%= pagination(stash('search.startPage'), $pages, $url) =%></div> |
| 10 | <p class="found">Found |
| 11 | <span id="total-results"><%= commify(stash('search.totalResults')) %> matches</span> |
| 12 | <% if (stash 'search.bm.hit') { %> in <%= stash 'search.bm.hit' %> (<%= stash 'search.bm.result' %>)<% } %> |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 13 | </p> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 14 | </div> |
| 15 | |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 16 | %= include 'query' |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 17 | % }; |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 18 | |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 19 | |
| 20 | |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 21 | <ol class="left-aligned"> |
| 22 | %= search_hits begin |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 23 | %# ID, title, corpusID, author, pubDate, textClass |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 24 | <li data-corpus-id="<%= $_->{corpusID} %>" |
| 25 | data-doc-id="<%= korap_doc_id($_) %>" |
| 26 | data-match-id="<%= korap_match_id($_) %>"> |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame] | 27 | <div> |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 28 | <div class="snippet"><%== $_->{snippet} %></div> |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame] | 29 | <div class="tokenInfo"></div> |
| 30 | </div> |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 31 | <p> |
| 32 | <strong><%= $_->{title} %></strong> |
| 33 | <%= $_->{author} ? ' by ' . $_->{author} : '' %>; |
| 34 | published on <%= date_format $_->{pubDate} %> |
| 35 | as <%= $_->{docID} %> (<%= $_->{corpusID} %>) |
| 36 | </p> |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 37 | <ul class="action right"> |
| 38 | <li onmouseup="closeSnippet(this)" title="close"><i class="fa fa-toggle-up"></i></li> |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 39 | <li onclick="showTable(this)" title="Annotations"><i class="fa fa-info-circle"></i></li> |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame] | 40 | <!-- |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 41 | <li title="Tree Visualizations"><i class="fa fa-sitemap"></i></li> |
| 42 | <li title="Remember"><i class="fa fa-star-o"></i></li> |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame] | 43 | --> |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 44 | </ul> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 45 | </li> |
| 46 | % end |
| 47 | </ol> |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 48 | |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 49 | % end |
Nils Diewald | 44a7278 | 2014-06-20 16:03:21 +0000 | [diff] [blame] | 50 | |
| 51 | % } |
| 52 | % else { |
| 53 | %= include 'intro' |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame] | 54 | % }; |