blob: 92aadced84ab11cfc6a0733ffff5a41a79a7a68a [file] [log] [blame]
Nils Diewald2329e1d2014-06-12 16:07:57 +00001% if (param 'q') {
Nils Diewald4af3f0b2014-06-25 01:43:17 +00002% content 'main' => begin
3%= search begin
4% unless (param 'snippet') {
Nils Diewald5d1ffb42014-05-21 17:45:34 +00005<div style="clear: both">
Nils Diewald4af3f0b2014-06-25 01:43:17 +00006% my $url = url_with->query(['p' => '{page}']);
7% my $pages = (stash('search.totalResults') / (stash('search.itemsPerPage') || 1));
8% $pages = $pages < 0 ? 0 : $pages;
Nils Diewald44a72782014-06-20 16:03:21 +00009 <div id="pagination"><%= pagination(stash('search.startPage'), $pages, $url) =%></div>
10 <p class="found">Found
11 <span id="total-results"><%= commify(stash('search.totalResults')) %> matches</span>
12 <% if (stash 'search.bm.hit') { %> in <%= stash 'search.bm.hit' %> (<%= stash 'search.bm.result' %>)<% } %>
Nils Diewald2329e1d2014-06-12 16:07:57 +000013 </p>
Nils Diewald5d1ffb42014-05-21 17:45:34 +000014</div>
Nils Diewald02df9912014-06-03 16:08:07 +000015%= include 'query'
Nils Diewald4af3f0b2014-06-25 01:43:17 +000016% };
Nils Diewald5d1ffb42014-05-21 17:45:34 +000017
Nils Diewald4af3f0b2014-06-25 01:43:17 +000018<div id="search">
Nils Diewald5d1ffb42014-05-21 17:45:34 +000019<ol class="left-aligned">
Nils Diewald4af3f0b2014-06-25 01:43:17 +000020%= search_hits begin
21%= include 'match', match => $_
22% end
Nils Diewald5d1ffb42014-05-21 17:45:34 +000023</ol>
Nils Diewald4af3f0b2014-06-25 01:43:17 +000024</div>
Nils Diewald44a72782014-06-20 16:03:21 +000025
Nils Diewald4af3f0b2014-06-25 01:43:17 +000026% end
Nils Diewald5d1ffb42014-05-21 17:45:34 +000027% end
Nils Diewald44a72782014-06-20 16:03:21 +000028
Nils Diewald4af3f0b2014-06-25 01:43:17 +000029% content 'javascript' => begin
30%= javascript begin
31
32$("#search > ol > li:not(.active)").on("click", function (e) {
33 $(this).addClass('active');
34 e.stopPropagation();
35});
36
37$("#search > ol > li:not(.active) > ul > li.close").on("click", function (e) {
38 $(this.parentNode.parentNode).removeClass('active');
39 e.stopPropagation();
40});
41
42% end
43% end
Nils Diewald1eba6572014-06-17 19:49:53 +000044% };