This controls the pager display at the bottom (by default) of the list and search views. It expects a pager template argument which responds to the Data::Page interface.
pager
</%doc>
% return unless $pager and ( $pager->first_page != $pager->last_page );
<p class="pager">Pages:
<%perl> 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; foreach my $num ( $begin_page .. $end_page ) { if ( $num == $pager->current_page ) { </%perl> <span class="current-page"><% $num %></span> <%perl> } else { my $args = "?page=$num"; $args .= "&order=" . $request->params->{order} if $request->params->{order}; $args .= "&o2=desc" if $request->params->{o2} eq "desc"; my $action = "list"; foreach my $col ( @{ $classmetadata->{columns} } ) { if ( $request->params->{ $col } ) { $args .= "&$col=" . $request->params->{ $col }; $action = "search"; } } </%perl> <& link, table => $classmetadata->{table}, command => $action, additional => $args, label => $num &> % } % } </p>
To install MasonX::Maypole, copy and paste the appropriate command in to your terminal.
cpanm
cpanm MasonX::Maypole
CPAN shell
perl -MCPAN -e shell install MasonX::Maypole
For more information on module installation, please visit the detailed CPAN module installation guide.