Akron | 3c390c4 | 2020-03-30 09:06:21 +0200 | [diff] [blame] | 1 | % layout 'main', schematype => 'SearchResultsPage'; |
Akron | c23ce66 | 2021-12-14 12:39:42 +0100 | [diff] [blame] | 2 | % my $numf = sub { return loc('numf', number => $_[0]) }; |
Nils Diewald | fccfbcb | 2015-04-29 20:48:19 +0000 | [diff] [blame] | 3 | |
Akron | 26d57f2 | 2021-09-10 16:48:57 +0200 | [diff] [blame] | 4 | <div id="pagination" |
| 5 | class="button-group button-panel" |
| 6 | data-page="<%= stash('start_page') %>" |
| 7 | data-total="<%= stash('total_pages') %>" |
| 8 | data-count="<%= stash('items_per_page') %>" |
Akron | c23ce66 | 2021-12-14 12:39:42 +0100 | [diff] [blame] | 9 | ><%= pagination(stash('start_page'), stash('total_pages'), url_with->query({'p' => '{page}'}), { num_format => $numf }) =%></div> |
Akron | 9bd140e | 2021-07-27 16:20:03 +0200 | [diff] [blame] | 10 | |
Akron | fb6d87d | 2018-10-24 18:10:20 +0200 | [diff] [blame] | 11 | <div id="resultinfo" <% if (stash('results')->size) { %> class="found"<%} %>> |
Akron | fb6d87d | 2018-10-24 18:10:20 +0200 | [diff] [blame] | 12 | % my $found = stash('total_results') // 0; |
Akron | b917a7c | 2015-07-02 11:02:42 +0200 | [diff] [blame] | 13 | <p class="found">\ |
Nils Diewald | fccfbcb | 2015-04-29 20:48:19 +0000 | [diff] [blame] | 14 | % if ($found != -1) { |
Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 15 | % my $found_text = loc('numf', number => $found); |
Akron | fb6d87d | 2018-10-24 18:10:20 +0200 | [diff] [blame] | 16 | % if (stash('time_exceeded')) { |
Nils Diewald | a898dac | 2015-05-06 21:04:16 +0000 | [diff] [blame] | 17 | % $found_text = '> ' . $found_text; |
Nils Diewald | fccfbcb | 2015-04-29 20:48:19 +0000 | [diff] [blame] | 18 | % }; |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 19 | <span id="total-results"><%= $found_text %></span> <%= loc('matchCount', found => $found) %>\ |
Akron | fb6d87d | 2018-10-24 18:10:20 +0200 | [diff] [blame] | 20 | %# <% if (stash('benchmark')) { %> (~ <%= stash('benchmark') %>)<% } %> |
| 21 | % } elsif (stash('start_index') == 0 && stash('results')->size == 0) { |
Akron | b917a7c | 2015-07-02 11:02:42 +0200 | [diff] [blame] | 22 | <span id="total-results">0</span> <%= loc('matchCount', found => $found) %>\ |
Nils Diewald | fccfbcb | 2015-04-29 20:48:19 +0000 | [diff] [blame] | 23 | % }; |
Akron | 179c8ac | 2015-06-30 19:30:50 +0200 | [diff] [blame] | 24 | </p> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 25 | </div> |
Nils Diewald | 5d1ffb4 | 2014-05-21 17:45:34 +0000 | [diff] [blame] | 26 | |
Akron | 27ae9ec | 2015-06-23 00:43:21 +0200 | [diff] [blame] | 27 | %= include 'query' |
Akron | 9cc3eaf | 2015-06-10 22:15:52 +0200 | [diff] [blame] | 28 | |
Nils Diewald | 4af3f0b | 2014-06-25 01:43:17 +0000 | [diff] [blame] | 29 | <div id="search"> |
Akron | fb6d87d | 2018-10-24 18:10:20 +0200 | [diff] [blame] | 30 | % if (stash('results')->size && stash('total_results') != 0) { |
Nils Diewald | fccfbcb | 2015-04-29 20:48:19 +0000 | [diff] [blame] | 31 | <ol class="align-left"> |
| 32 | %= search_results begin |
| 33 | %= include 'match', match => $_ |
Nils Diewald | 4af3f0b | 2014-06-25 01:43:17 +0000 | [diff] [blame] | 34 | % end |
Nils Diewald | fccfbcb | 2015-04-29 20:48:19 +0000 | [diff] [blame] | 35 | </ol> |
Akron | fb6d87d | 2018-10-24 18:10:20 +0200 | [diff] [blame] | 36 | % } elsif (stash('results')->size == 0) { |
| 37 | <p class="no-results"><%= loc 'noMatches', q => stash('q'), ql => stash('ql') %></p> |
Nils Diewald | fccfbcb | 2015-04-29 20:48:19 +0000 | [diff] [blame] | 38 | % } |
Akron | 4cdc4fc | 2020-04-28 12:19:11 +0200 | [diff] [blame] | 39 | %= content_for 'after_search_results' |
Akron | 48b1e4d | 2015-06-17 18:47:01 +0200 | [diff] [blame] | 40 | </div> |