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