<%doc> =head1 pager This controls the pager display at the bottom (by default) of the list and search views. It expects a C template argument which responds to the L interface.

Pages: % foreach my $page ( $begin_page .. $end_page ) { % if ( $page == $pager->current_page ) { <% $page %> % } else { <& .page_link, page => $page &> % } % }

% # -------------------------------------------------------------------------- <%init> our $pager; return unless $pager; # and ( $pager->first_page != $pager->last_page ); my $begin_page = $pager->current_page - 10; $begin_page = $pager->first_page if $begin_page < 1; my $end_page = $pager->current_page + 10; $end_page = $pager->last_page if $pager->last_page < $end_page; % # -------------------------------------------------------------------------- <%def .page_link> <%args> $page <% $request->link( table => $request->model_class->table, action => $request->action, additional => $args, label => $page, ) %> <%init> my $args = "?page=$page"; my %params = %{ $request->params }; delete $params{page}; %params = () if ( $request->action ne 'list' && $request->action ne 'do_search' ); my $uri = URI->new; $uri->query_form( %params ); $args .= "&".$uri->equery if $uri->equery;