blob: 077e93bfc17216a864ba2672e4d5a10a2691c1af [file] [log] [blame]
% if (param 'q') {
% content 'main' => begin
%= search begin
% unless (param 'snippet') {
<div style="clear: both">
% my $url = url_with->query(['p' => '{page}']);
% my $pages = (stash('search.totalResults') / (stash('search.itemsPerPage') || 1));
% $pages = $pages < 0 ? 0 : $pages;
<div id="pagination"><%= pagination(stash('search.startPage'), $pages, $url) =%></div>
<p class="found">Found
% my $found = stash('search.totalResults');
% if ($found == -1) {
% $found = 'unknown amount of';
% } elsif (stash('search.timeExceeded')) {
% $found = 'more than ' . $found;
% };
<span id="total-results"><%= $found %> matches</span>
<% if (stash 'search.benchmark') { %> in <%= stash 'search.benchmark' %><% } %>
</p>
</div>
%= include 'query'
%= include 'api-communication'
% };
% if (stash('search.totalResults') != 0 && scalar @{stash('search.hits')}) {
<div id="search">
<ol class="left-aligned">
%= search_hits begin
%= include 'match', match => $_
% end
</ol>
</div>
% };
% end
% end
% content 'javascript' => begin
%= javascript begin
$("#search > ol > li:not(.active)").on("click", function (e) {
$(this).addClass('active');
e.stopPropagation();
});
$("#search > ol > li:not(.active) > ul > li.close").on("click", function (e) {
$(this.parentNode.parentNode).removeClass('active');
e.stopPropagation();
});
% end
% end
% };