blob: 3fe630259d0841c72932dcb62182ed58e1a71f1d [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;
% $pages = stash('search.totalResults') == -1 ? -1 : (stash('search.totalResults') / (stash('search.itemsPerPage') || 1));
<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
% };