Bug 15839: [QA Follow-up] Paging on opac-showreviews
Paging is kind of messy here. This patch at least improves somewhat. The page number should be rounded. The results per page should be passed to the template too. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Tested a number of reviews and played with count parameter in URL. Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
ac59bed98a
commit
b5c3b1c974
2 changed files with 7 additions and 6 deletions
|
@ -154,21 +154,21 @@
|
||||||
<div class="pages">
|
<div class="pages">
|
||||||
<!-- Row of numbers corresponding to showreviews result pages -->
|
<!-- Row of numbers corresponding to showreviews result pages -->
|
||||||
[% IF ( previous_page_offset ) %]
|
[% IF ( previous_page_offset ) %]
|
||||||
<a class="nav" href="/cgi-bin/koha/opac-showreviews.pl?offset=[% previous_page_offset %]"><< Previous</a>
|
<a class="nav" href="/cgi-bin/koha/opac-showreviews.pl?offset=[% previous_page_offset %]&count=[% results_per_page %]"><< Previous</a>
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
[% IF ( previous_page_first ) %]
|
[% IF ( previous_page_first ) %]
|
||||||
<a class="nav" href="/cgi-bin/koha/opac-showreviews.pl?offset=0"><< Previous</a>
|
<a class="nav" href="/cgi-bin/koha/opac-showreviews.pl?offset=0&count=[% results_per_page %]"><< Previous</a>
|
||||||
[% END %]
|
[% END %]
|
||||||
[% END %]
|
[% END %]
|
||||||
[% FOREACH PAGE_NUMBER IN PAGE_NUMBERS %]
|
[% FOREACH PAGE_NUMBER IN PAGE_NUMBERS %]
|
||||||
[% IF ( PAGE_NUMBER.highlight ) %]
|
[% IF ( PAGE_NUMBER.highlight ) %]
|
||||||
<span class="currentPage">[% PAGE_NUMBER.pg %]</span>
|
<span class="currentPage">[% PAGE_NUMBER.pg %]</span>
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
<a class="nav" href="/cgi-bin/koha/opac-showreviews.pl?offset=[% PAGE_NUMBER.offset %]">[% PAGE_NUMBER.pg %]</a>
|
<a class="nav" href="/cgi-bin/koha/opac-showreviews.pl?offset=[% PAGE_NUMBER.offset %]&count=[% results_per_page %]">[% PAGE_NUMBER.pg %]</a>
|
||||||
[% END %]
|
[% END %]
|
||||||
[% END %]
|
[% END %]
|
||||||
[% IF ( next_page_offset ) %]
|
[% IF ( next_page_offset ) %]
|
||||||
<a class="nav" href="/cgi-bin/koha/opac-showreviews.pl?offset=[% next_page_offset %]">Next >></a>
|
<a class="nav" href="/cgi-bin/koha/opac-showreviews.pl?offset=[% next_page_offset %]&count=[% results_per_page %]">Next >></a>
|
||||||
[% END %]
|
[% END %]
|
||||||
</div>
|
</div>
|
||||||
[% END # / IF PAGE_NUMBERS %]
|
[% END # / IF PAGE_NUMBERS %]
|
||||||
|
|
|
@ -30,7 +30,7 @@ use C4::Biblio;
|
||||||
use C4::Members qw/GetMemberDetails/;
|
use C4::Members qw/GetMemberDetails/;
|
||||||
use Koha::DateUtils;
|
use Koha::DateUtils;
|
||||||
use Koha::Reviews;
|
use Koha::Reviews;
|
||||||
use POSIX qw(ceil strftime);
|
use POSIX qw(ceil floor strftime);
|
||||||
|
|
||||||
my $template_name;
|
my $template_name;
|
||||||
my $query = new CGI;
|
my $query = new CGI;
|
||||||
|
@ -38,7 +38,7 @@ my $format = $query->param("format") || '';
|
||||||
my $count = C4::Context->preference('OPACnumSearchResults') || 20;
|
my $count = C4::Context->preference('OPACnumSearchResults') || 20;
|
||||||
my $results_per_page = $query->param('count') || $count;
|
my $results_per_page = $query->param('count') || $count;
|
||||||
my $offset = $query->param('offset') || 0;
|
my $offset = $query->param('offset') || 0;
|
||||||
my $page = $offset / $results_per_page + 1;
|
my $page = floor( $offset / $results_per_page ) + 1;
|
||||||
|
|
||||||
if ($format eq "rss") {
|
if ($format eq "rss") {
|
||||||
$template_name = "opac-showreviews-rss.tt";
|
$template_name = "opac-showreviews-rss.tt";
|
||||||
|
@ -180,6 +180,7 @@ $template->param(next_page_offset => $next_page_offset) unless $pages eq $curren
|
||||||
|
|
||||||
$template->param(
|
$template->param(
|
||||||
reviews => $reviews,
|
reviews => $reviews,
|
||||||
|
results_per_page => $results_per_page,
|
||||||
);
|
);
|
||||||
|
|
||||||
output_html_with_http_headers $query, $cookie, $template->output;
|
output_html_with_http_headers $query, $cookie, $template->output;
|
||||||
|
|
Loading…
Reference in a new issue