Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 1 | % layout 'default', title 'KorAP'; |
| 2 | % use JSON::XS; |
| 3 | |
| 4 | |
| 5 | %= search begin |
| 6 | <div style="clear: both"> |
| 7 | <p class="found"><span class="pagination"> |
| 8 | % my $url = url_with->query(['p' => '{page}']); |
| 9 | % my $pages = (stash('search.totalResults') / (stash('search.itemsPerPage') || 1)); |
| 10 | % $pages = $pages < 0 ? 0 : $pages; |
| 11 | <%= pagination(stash('search.startPage'), $pages, $url); %></span> |
Nils Diewald | dd2d4e8 | 2014-05-31 17:08:33 +0000 | [diff] [blame^] | 12 | Found <span id="total-results"><%= commify(stash('search.totalResults')) %> matches</span> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 13 | % if (stash 'search.bm.hit') { |
| 14 | in <%= stash 'search.bm.hit' %> (<%= stash 'search.bm.result' %>) |
| 15 | % } |
| 16 | </p> |
| 17 | </div> |
| 18 | |
| 19 | |
Nils Diewald | dd2d4e8 | 2014-05-31 17:08:33 +0000 | [diff] [blame^] | 20 | %= notifications 'Humane' |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 21 | |
| 22 | |
| 23 | % if (stash('search.query')) { |
| 24 | <code><span>JSON-LD Query</span><pre> |
| 25 | % my $json = JSON::XS->new->pretty; |
| 26 | %= $json->encode(stash('search.query')) |
| 27 | </pre></span></code> |
| 28 | % } |
| 29 | |
| 30 | |
| 31 | <ol class="left-aligned"> |
| 32 | %= search_hits begin |
| 33 | <li> |
| 34 | %# ID, title, corpusID, author, pubDate, textClass |
| 35 | <%== $_->{snippet} %> |
| 36 | </li> |
| 37 | % end |
| 38 | </ol> |
| 39 | % end |
| 40 | |
| 41 | |
Nils Diewald | dd2d4e8 | 2014-05-31 17:08:33 +0000 | [diff] [blame^] | 42 | %= javascript begin |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 43 | $("li,code").on("click", function () { |
| 44 | $(this).toggleClass('active'); |
| 45 | }); |
Nils Diewald | dd2d4e8 | 2014-05-31 17:08:33 +0000 | [diff] [blame^] | 46 | % end |