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 | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame^] | 29 | |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 30 | <li data-corpus-id="<%= $_->{corpusID} %>" |
| 31 | data-doc-id="<%= korap_doc_id($_) %>" |
| 32 | data-match-id="<%= korap_match_id($_) %>"> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 33 | %# ID, title, corpusID, author, pubDate, textClass |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame^] | 34 | <div> |
| 35 | <div class="snippet"> |
| 36 | <%== $_->{snippet} %> |
| 37 | </div> |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 38 | |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 39 | %# as <%= $_->{ID} %> |
| 40 | %# textClass docID |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 41 | %# foreach (grep { m!/morpho$! } split(/\s+/, $_->{foundries})) { |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 42 | %# <%= $_ %> |
Nils Diewald | 33e1555 | 2014-06-13 19:38:37 +0000 | [diff] [blame] | 43 | %# }; |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 44 | |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame^] | 45 | <div class="tokenInfo"></div> |
| 46 | </div> |
| 47 | <p><strong><%= $_->{title} %></strong><%= $_->{author} ? ' by ' . $_->{author} : '' %>; published on <%= date_format $_->{pubDate} %> as <%= $_->{docID} %> (<%= $_->{corpusID} %>)</p> |
| 48 | |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 49 | <ul class="action right"> |
| 50 | <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] | 51 | <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^] | 52 | <!-- |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 53 | <li title="Tree Visualizations"><i class="fa fa-sitemap"></i></li> |
| 54 | <li title="Remember"><i class="fa fa-star-o"></i></li> |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame^] | 55 | --> |
Nils Diewald | 2329e1d | 2014-06-12 16:07:57 +0000 | [diff] [blame] | 56 | </ul> |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame^] | 57 | |
| 58 | |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 59 | </li> |
| 60 | % end |
| 61 | </ol> |
| 62 | % end |
Nils Diewald | 1eba657 | 2014-06-17 19:49:53 +0000 | [diff] [blame^] | 63 | % } else { |
| 64 | <div id="intro"> |
| 65 | <p>This is the alternative KorAP Frontend.</p> |
| 66 | <p>The primary goal is to serve as a testbed for the query serialization and for different flavours of user interfaces.</p> |
| 67 | <p>Search capabilities are limited to the demo user.</p> |
| 68 | </div> |
| 69 | % }; |