From 655f9176d9ecf55590f2b823f8166f310ea31542 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juhani=20Sepp=C3=A4l=C3=A4?= Date: Thu, 26 Jun 2014 11:28:19 +0300 Subject: [PATCH] Bug 12481: Staff client detail-view "next" link is greyed out when the last search result of any results page is clicked or navigated into MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When doing a staff client catalog search with more than 1 page of results and clicking the last result on any search result page, the top-left navigation button for "next" is greyed out. Tested on newest Firefox & Chromium. Attempts to restore originally planned checks for navigation with the exception of not using results.length due to buggy behaviour where the results get concatenated upon page reload & "return to results" navigation - a separate issue? To test: 1) Do an intranet catalog search that has more than 1 page of results. 2) Click on the last result on a page that is not the last one & confirm that the navigation button "next" is greyed out. 4) Apply patch. 5) Do an intranet search with more than 1 but less results than fit on a single page. 6) Click on the last result on the page and confirm that the "Next" navigation button is greyed out. 6) Do an intranet search with more than 1 page of results. 7) Click on the last result of a page that's not the final page of the results & confirm that "Next" is not grey out. 8) Navigate to the last page of the results and click on the final result & confirm that "Next" is greyd out. http://bugs.koha-community.org/show_bug.cgi?id=12481 This patch prevents the "Next" button on detail view to be grayed out at the end of e result page. Signed-off-by: Marc Véron --- koha-tmpl/intranet-tmpl/js/browser.js | 7 ++++--- koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/js/browser.js b/koha-tmpl/intranet-tmpl/js/browser.js index 4d0fc36..b0676a5 100644 --- a/koha-tmpl/intranet-tmpl/js/browser.js +++ b/koha-tmpl/intranet-tmpl/js/browser.js @@ -25,7 +25,7 @@ KOHA.browser = function (searchid, biblionumber) { } } - this.create = function (offset, query, limit, sort, newresults) { + this.create = function (offset, query, limit, sort, newresults, total) { if (me.searchCookie) { if (offset === me.searchCookie.offset - newresults.length) { me.searchCookie.results = newresults.concat(me.searchCookie.results); @@ -41,7 +41,8 @@ KOHA.browser = function (searchid, biblionumber) { limit: limit, sort: sort, pagelen: newresults.length, - results: newresults + results: newresults, + total: total }; //Bug_11369 Cleaning up excess searchCookies to prevent cookie overflow in the browser memory. @@ -81,7 +82,7 @@ KOHA.browser = function (searchid, biblionumber) { } else { prevbutton = '« ' + BROWSER_PREVIOUS + ''; } - if (me.curPos === me.searchCookie.pagelen - 1) { + if (me.searchCookie.offset + me.curPos == me.searchCookie.total) { nextbutton = '' + BROWSER_NEXT + ' »'; } else { nextbutton = '' + BROWSER_NEXT + ' »'; diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 21c2866..34296b6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -139,7 +139,8 @@ $('#sort_by').change(function() { [%- END -%] ]; var browser = KOHA.browser('[% searchid %]', parseInt('[% biblionumber %]', 10)); - browser.create([% SEARCH_RESULTS.first.result_number %], '[% query_cgi | uri %]', '[% limit_cgi | uri %]', '[% sort_cgi | uri %]', newresults); + browser.create([% SEARCH_RESULTS.first.result_number %], '[% query_cgi | uri %]', '[% limit_cgi | uri %]','[% sort_cgi | uri %]', + newresults, '[% total %]'); [% END %] [% IF (gotoPage && gotoNumber) %] [% IF (gotoNumber == 'first') %] -- 1.7.10.4