blob: 7cfa79190601dbc50bca54ceb4cda74b2a2149ac [file] [log] [blame]
Nils Diewald2329e1d2014-06-12 16:07:57 +00001% if (param 'q') {
Nils Diewald5d1ffb42014-05-21 17:45:34 +00002%= search begin
Nils Diewald2329e1d2014-06-12 16:07:57 +00003
4% unless (param 'snippet') {
Nils Diewald5d1ffb42014-05-21 17:45:34 +00005<div style="clear: both">
Nils Diewald2329e1d2014-06-12 16:07:57 +00006 <p class="found">
7 <span class="pagination">
Nils Diewald5d1ffb42014-05-21 17:45:34 +00008% my $url = url_with->query(['p' => '{page}']);
9% my $pages = (stash('search.totalResults') / (stash('search.itemsPerPage') || 1));
10% $pages = $pages < 0 ? 0 : $pages;
Nils Diewald2329e1d2014-06-12 16:07:57 +000011 </span>
Nils Diewald02df9912014-06-03 16:08:07 +000012
Nils Diewald2329e1d2014-06-12 16:07:57 +000013 <div id="pagination">
Nils Diewald02df9912014-06-03 16:08:07 +000014%= pagination(stash('search.startPage'), $pages, $url)
Nils Diewald2329e1d2014-06-12 16:07:57 +000015 </div>
Nils Diewald02df9912014-06-03 16:08:07 +000016
Nils Diewalddd2d4e82014-05-31 17:08:33 +000017Found <span id="total-results"><%= commify(stash('search.totalResults')) %> matches</span>
Nils Diewald5d1ffb42014-05-21 17:45:34 +000018% if (stash 'search.bm.hit') {
19 in <%= stash 'search.bm.hit' %> (<%= stash 'search.bm.result' %>)
20% }
Nils Diewald2329e1d2014-06-12 16:07:57 +000021 </p>
Nils Diewald5d1ffb42014-05-21 17:45:34 +000022</div>
23
Nils Diewald02df9912014-06-03 16:08:07 +000024%= include 'query'
Nils Diewald2329e1d2014-06-12 16:07:57 +000025% };
Nils Diewald5d1ffb42014-05-21 17:45:34 +000026
27<ol class="left-aligned">
28%= search_hits begin
Nils Diewald33e15552014-06-13 19:38:37 +000029 <li data-corpus-id="<%= $_->{corpusID} %>"
30 data-doc-id="<%= korap_doc_id($_) %>"
31 data-match-id="<%= korap_match_id($_) %>">
Nils Diewald5d1ffb42014-05-21 17:45:34 +000032%# ID, title, corpusID, author, pubDate, textClass
Nils Diewald2329e1d2014-06-12 16:07:57 +000033 <div class="snippet"><%== $_->{snippet} %></div>
34 <p><strong><%= $_->{title} %></strong><%= $_->{author} ? ' by ' . $_->{author} : '' %>; published on <%= date_format $_->{pubDate} %> as <%= $_->{docID} %> (<%= $_->{corpusID} %>)</p>
Nils Diewald33e15552014-06-13 19:38:37 +000035
Nils Diewald2329e1d2014-06-12 16:07:57 +000036%# as <%= $_->{ID} %>
37%# textClass docID
Nils Diewald33e15552014-06-13 19:38:37 +000038%# foreach (grep { m!/morpho$! } split(/\s+/, $_->{foundries})) {
Nils Diewald2329e1d2014-06-12 16:07:57 +000039%# <%= $_ %>
Nils Diewald33e15552014-06-13 19:38:37 +000040%# };
Nils Diewald2329e1d2014-06-12 16:07:57 +000041
42 <ul class="action right">
43 <li onmouseup="closeSnippet(this)" title="close"><i class="fa fa-toggle-up"></i></li>
Nils Diewald33e15552014-06-13 19:38:37 +000044 <li onclick="showTable(this)" title="Annotations"><i class="fa fa-info-circle"></i></li>
Nils Diewald2329e1d2014-06-12 16:07:57 +000045 <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 Diewald5d1ffb42014-05-21 17:45:34 +000048 </li>
49% end
50</ol>
51% end
Nils Diewald2329e1d2014-06-12 16:07:57 +000052% }