summaryrefslogtreecommitdiff
path: root/templates/displayheaders/_pagination3.html.ep
blob: 846a285cc7fc8c005f34b9c9cb3ab21cb77bec1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
% my $make_link_num = begin
%   my ($txt, $to) = @_;
%=  link_to $txt => url_with->query({start => $to}) => (class => (param('start')//0) == $to ? 'pagination-link is-current' : 'pagination-link')
% end

% my $nbh = begin
%   my $num = $pgn->{total_pages} > 5 ? 5 : $pgn->{total_pages};
%   my $start = $pgn->{current_page}-2 < 0 ? 0 : $pgn->{current_page}-2;
%   if ($start+$num > $pgn->{total_pages}) { $start = $pgn->{total_pages}-$num }

%   for ($start..$start+$num-1) {
      <li>
%=    $make_link_num->($_+1 => $_*$pgn->{page_size})
      </li>
%   }
% end

<nav class="pagination is-centered">
  <ul class="pagination-list">
    <li>
      %= $c->_paginate->make_link('Prev' => 'prev_page', class => 'pagination-link', class_disabled => 'is-disabled')
    </li>
    %= $nbh->()
    <li>
      %= $c->_paginate->make_link('Next' => 'next_page', class => 'pagination-link', class_disabled => 'is-disabled')
  </ul>
</nav>