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 | |
| 17 | %#= l('Found <span id="total-results">[_1]</span> [quant,_1,match]') |
| 18 | %#= l('in [_1]) |
Nils Diewald | dd2d4e8 | 2014-05-31 17:08:33 +0000 | [diff] [blame] | 19 | Found <span id="total-results"><%= commify(stash('search.totalResults')) %> matches</span> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 20 | % if (stash 'search.bm.hit') { |
| 21 | in <%= stash 'search.bm.hit' %> (<%= stash 'search.bm.result' %>) |
| 22 | % } |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame^] | 23 | </p> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 24 | </div> |
| 25 | |
Nils Diewald | 02df991 | 2014-06-03 16:08:07 +0000 | [diff] [blame] | 26 | %= include 'query' |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame^] | 27 | % }; |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 28 | |
| 29 | <ol class="left-aligned"> |
| 30 | %= search_hits begin |
| 31 | <li> |
| 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> |
| 35 | %# as <%= $_->{ID} %> |
| 36 | %# textClass docID |
| 37 | % foreach (grep { m!/morpho$! } split(/\s+/, $_->{foundries})) { |
| 38 | %# <%= $_ %> |
| 39 | % }; |
| 40 | |
| 41 | <ul class="action right"> |
| 42 | <li onmouseup="closeSnippet(this)" title="close"><i class="fa fa-toggle-up"></i></li> |
| 43 | <li title="Annotations"><i class="fa fa-info-circle"></i></li> |
| 44 | <li title="Tree Visualizations"><i class="fa fa-sitemap"></i></li> |
| 45 | <li title="Remember"><i class="fa fa-star-o"></i></li> |
| 46 | </ul> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 47 | </li> |
| 48 | % end |
| 49 | </ol> |
| 50 | % end |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame^] | 51 | % } |