It would be nice if the page navigation for the OPAC and staff result lists allowed to jump to the last/first page of the results.
Something else that would be helpful is a box where you can enter the page that you want to jump to. This is also an accessibility problem as our current way of paging makes it harder to work with long result lists.
Created attachment 60229 [details] [review] Bug 13205: Last/first page options for result list paging This patch adds first and last page buttons to the pagination at the bottom of a page of catalog search results. To test: 1) Apply patch 2) Do a number of searches 3) For each search, ensure that the first and last page buttons work as expected Sponsored-by: Catalyst IT
Created attachment 60248 [details] [review] Bug 13205: Last/first page options for result list paging This patch adds first and last page buttons to the pagination at the bottom of a page of catalog search results. To test: 1) Apply patch 2) Do a number of searches 3) For each search, ensure that the first and last page buttons work as expected Sponsored-by: Catalyst IT Followed test plan, works as expected. Signed-off-by: Marc Véron <veron@veron.ch>
Created attachment 60300 [details] [review] Bug 13205: Last/first page options for result list paging for OPAC Same fix but on OPAC side. Same test plan Sponsored-by: Catalyst IT
Created attachment 61194 [details] [review] Bug 13205: Last/first page options for result list paging for OPAC Same fix but on OPAC side. Same test plan Sponsored-by: Catalyst IT Signed-off-by: Dilan Johnpulle <dilan@calyx.net.au> Signed-off-by: Your Full Name <your_email>
Comment on attachment 61194 [details] [review] Bug 13205: Last/first page options for result list paging for OPAC >From bd80eca290f389e8e12d63dd220ec639763adcbb Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Thu, 16 Feb 2017 02:28:13 +0000 >Subject: [PATCH] Bug 13205: Last/first page options for result list paging for > OPAC > >Same fix but on OPAC side. Same test plan > >Sponsored-by: Catalyst IT > >Signed-off-by: Dilan Johnpulle <dilan@calyx.net.au> > >--- > .../bootstrap/en/includes/page-numbers.inc | 26 ++++++++++++---------- > opac/opac-search.pl | 2 ++ > 2 files changed, 16 insertions(+), 12 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >index f18c9ce..63e083e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/page-numbers.inc >@@ -1,19 +1,21 @@ > [% IF ( PAGE_NUMBERS ) %] > <div class="pagination pagination-small noprint"> > <ul> >- [% IF ( previous_page_offset.defined ) %] >- <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% previous_page_offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]">« Previous</a></li> >- [% END %] >- [% FOREACH PAGE_NUMBER IN PAGE_NUMBERS %] >- [% IF ( PAGE_NUMBER.highlight ) %] >- <li class="active"><a href="#">[% PAGE_NUMBER.pg %]</a></li> >- [% ELSE %] >- <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% PAGE_NUMBER.offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html%][% END %]">[% PAGE_NUMBER.pg %]</a></li> >+ <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]">First</a></li> >+ [% IF ( previous_page_offset.defined ) %] >+ <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% previous_page_offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]">« Previous</a></li> > [% END %] >- [% END %] >- [% IF ( next_page_offset ) %] >- <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% next_page_offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]">Next »</a></li> >- [% END %] >+ [% FOREACH PAGE_NUMBER IN PAGE_NUMBERS %] >+ [% IF ( PAGE_NUMBER.highlight ) %] >+ <li class="active"><a href="#">[% PAGE_NUMBER.pg %]</a></li> >+ [% ELSE %] >+ <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% PAGE_NUMBER.offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html%][% END %]">[% PAGE_NUMBER.pg %]</a></li> >+ [% END %] >+ [% END %] >+ [% IF ( next_page_offset ) %] >+ <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% next_page_offset %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]">Next »</a></li> >+ [% END %] >+ <li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %]&offset=[% last_page %][% IF ( sort_by ) %]&sort_by=[% sort_by |html %][% END %]">Last</a></li> > </ul> > </div> > [% END %] >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index a84e9d3..130aad3 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -837,6 +837,7 @@ for (my $i=0;$i<@servers;$i++) { > my @page_numbers; > # total number of pages there will be > my $pages = ceil($hits / $results_per_page); >+ my $last_page = ($pages * $results_per_page) - $results_per_page; > # default page number > my $current_page_number = 1; > if ($offset) { >@@ -887,6 +888,7 @@ for (my $i=0;$i<@servers;$i++) { > > } > $template->param( PAGE_NUMBERS => \@page_numbers, >+ last_page => $last_page, > previous_page_offset => $previous_page_offset) unless $pages < 2; > $template->param(next_page_offset => $next_page_offset) unless $pages eq $current_page_number; > } >-- >2.1.4
Hi Aleisha, It's a bit more complicated, we do not want to see First and Last when they are not needed (for instance if you are on the first or last page). I would have written my $last_page = ($pages * $results_per_page) - $results_per_page; that way: my $last_page = $pages * ( $results_per_page - 1 ); Sounds more readable.
Created attachment 64670 [details] [review] Bug 13205: [FOLLOW-UP] Some extra logic See Comment 8. Test: When on first page of results, confirm that the 'First' and 'Previous' buttons do not show. Confirm they come back on the second page and every page after. When on last page of results, confirm that the 'Last' and 'Next' buttons do not show. Confirm they come back on all previous pages. Check on both staff side and OPAC. Sponsored-by: Catalyst IT
Tested on the BibLibre's sandbox #2. Behavior is exactly the same for staff client and OPAC : - Display is correct for the button "First" : it not visible when you're on the first page (neither button "<< Previous"); using it brings you back to the first page. - I had more difficulties with button "Last" (expect explanations will be clear...): > Using the button "Last" didn't always bring me to the last page (I arrived page 167 instead of 174 // for only 2 pages result, I arrived on a blank page // it was ok for a result with 18 pages) > I had problem on the number of the pages : after clicking on "Last", all the pages were named "[page_number].[number]" : I searched different keywords and the number after the dot was always different (.05 ; .25 ; .18). When I went to the last pages without using the button "Last", the numbers appear correctly. > on the last page, both buttons "Last" and "Next" appear once I used one of them. Display is correct (none of them visible) when I went to the last page not using "Last" but jumping for one page to another until the last one. I agree with Katrin about a box to enter the page we want to go to. I also think it would be useful to have on staff client the pagination appearing both at the top and the bottom of the page result (like it is on the OPAC).
Created attachment 64938 [details] [review] Bug 13205: [FOLLOW-UP] Fixing math and variable names Have changed my $last_page = $pages * ( $results_per_page - 1 ); to my $last_page = ( $pages - 1) * $results_per_page; which seems to fix the 'last' button offset! (Comment 10) Will add the box to jump to a page in a separate patch. Adding the pagination to the top on the staff client will be dealt with in Bug 18916 as it is slightly out of the scope of this bug.
(In reply to Aleisha Amohia from comment #11) > Created attachment 64938 [details] [review] [review] > Bug 13205: [FOLLOW-UP] Fixing math and variable names > > Have changed > my $last_page = $pages * ( $results_per_page - 1 ); > to > my $last_page = ( $pages - 1) * $results_per_page; > which seems to fix the 'last' button offset! (Comment 10) > > Will add the box to jump to a page in a separate patch. Actually, my apologies - I had written a patch for this in Bug 18128 > Adding the pagination to the top on the staff client will be dealt with > in Bug 18916 as it is slightly out of the scope of this bug.
Created attachment 64981 [details] [review] [SIGNED-OFF] Bug 13205: Last/first page options for result list paging This patch adds first and last page buttons to the pagination at the bottom of a page of catalog search results. To test: 1) Apply patch 2) Do a number of searches 3) For each search, ensure that the first and last page buttons work as expected Sponsored-by: Catalyst IT Followed test plan, works as expected. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Created attachment 64982 [details] [review] [SIGNED-OFF] Bug 13205: Last/first page options for result list paging for OPAC Same fix but on OPAC side. Same test plan Sponsored-by: Catalyst IT Signed-off-by: Dilan Johnpulle <dilan@calyx.net.au> Signed-off-by: Your Full Name <your_email> Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Created attachment 64983 [details] [review] [SIGNED-OFF] Bug 13205: [FOLLOW-UP] Some extra logic See Comment 8. Test: When on first page of results, confirm that the 'First' and 'Previous' buttons do not show. Confirm they come back on the second page and every page after. When on last page of results, confirm that the 'Last' and 'Next' buttons do not show. Confirm they come back on all previous pages. Check on both staff side and OPAC. Sponsored-by: Catalyst IT Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Created attachment 64984 [details] [review] [SIGNED-OFF] Bug 13205: [FOLLOW-UP] Fixing math and variable names Have changed my $last_page = $pages * ( $results_per_page - 1 ); to my $last_page = ( $pages - 1) * $results_per_page; which seems to fix the 'last' button offset! (Comment 10) Will add the box to jump to a page in a separate patch. Adding the pagination to the top on the staff client will be dealt with in Bug 18916 as it is slightly out of the scope of this bug. Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
Created attachment 67774 [details] [review] Bug 13205: Last/first page options for result list paging This patch adds first and last page buttons to the pagination at the bottom of a page of catalog search results. To test: 1) Apply patch 2) Do a number of searches 3) For each search, ensure that the first and last page buttons work as expected Sponsored-by: Catalyst IT Followed test plan, works as expected. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Lee Jamison <ldjamison@marywood.edu> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 67775 [details] [review] Bug 13205: Last/first page options for result list paging for OPAC Same fix but on OPAC side. Same test plan Sponsored-by: Catalyst IT Signed-off-by: Dilan Johnpulle <dilan@calyx.net.au> Signed-off-by: Your Full Name <your_email> Signed-off-by: Lee Jamison <ldjamison@marywood.edu> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 67776 [details] [review] Bug 13205: [FOLLOW-UP] Some extra logic See Comment 8. Test: When on first page of results, confirm that the 'First' and 'Previous' buttons do not show. Confirm they come back on the second page and every page after. When on last page of results, confirm that the 'Last' and 'Next' buttons do not show. Confirm they come back on all previous pages. Check on both staff side and OPAC. Sponsored-by: Catalyst IT Signed-off-by: Lee Jamison <ldjamison@marywood.edu> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Created attachment 67777 [details] [review] Bug 13205: [FOLLOW-UP] Fixing math and variable names Have changed my $last_page = $pages * ( $results_per_page - 1 ); to my $last_page = ( $pages - 1) * $results_per_page; which seems to fix the 'last' button offset! (Comment 10) Will add the box to jump to a page in a separate patch. Adding the pagination to the top on the staff client will be dealt with in Bug 18916 as it is slightly out of the scope of this bug. Signed-off-by: Lee Jamison <ldjamison@marywood.edu> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Pushed to master for 17.11, thanks to everybody involved!