From fc3bc961095280ba60db72b466762339f9d05905 Mon Sep 17 00:00:00 2001 From: Srdjan Date: Mon, 27 Nov 2017 17:38:02 +1300 Subject: [PATCH] Bug 17602: fix RecordedBooks results pagination Signed-off-by: Jonathan Druart Signed-off-by: Nick Clemens --- .../bootstrap/en/includes/opac-bottom.inc | 23 +++++++++++++++ .../en/modules/opac-recordedbooks-search.tt | 16 +++++------ .../opac-tmpl/bootstrap/js/recordedbooks.js | 28 +++++++++---------- 3 files changed, 45 insertions(+), 22 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc index d34c5dbef2..12188f8d80 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -121,6 +121,29 @@ $.widget.bridge('uitooltip', $.ui.tooltip); var MSG_CONFIRM_AGAIN = _("Warning: Cannot be undone. Please confirm once again") var MSG_DELETE_SEARCH_HISTORY = _("Are you sure you want to delete your search history?"); var MSG_NO_SUGGESTION_SELECTED = _("No suggestion was selected"); + var MSG_SEARCHING = _("Searching %s..."); + var MSG_ERROR_SEARCHING_COLLECTION = _("Error searching %s collection"); + var MSG_NO_RESULTS_FOUND_IN_COLLECTION = _("No results found in the library's %s collection"); + var MSG_RESULTS_FOUND_IN_COLLECTION = _("Found %s results in the library's %s collection"); + var MSG_BY = _("by"); + var MSG_TYPE = _("Type"); + var MSG_NEXT = _("Next"); + var MSG_PREVIOUS = _("Previous"); + var MSG_CHECKOUTS = _("Checkouts"); + var MSG_NO_CHECKOUTS = _("No checkouts"); + var MSG_CHECK_OUT = _("Check out"); + var MSG_CHECK_OUT_CONFIRM = _("Are you sure you want to checkout this item?"); + var MSG_CHECKED_OUT_UNTIL = _("Checked out until %s"); + var MSG_CHECK_IN = _("Check in"); + var MSG_CHECK_IN_CONFIRM = _("Are you sure you want to return this item?"); + var MSG_NO_CHECKOUTS = _("No checkouts"); + var MSG_DOWNLOAD = _("Download"); + var MSG_HOLDS = _("Holds"); + var MSG_NO_HOLDS = _("No holds"); + var MSG_PLACE_HOLD = _("Place hold"); + var MSG_CANCEL_HOLD = _("Cancel"); + var MSG_CANCEL_HOLD_CONFIRM = _("Are you sure you want to cancel this hold?"); + var MSG_ON_HOLD = _("On hold"); [% IF Koha.Preference( 'opacbookbag' ) == 1 or Koha.Preference( 'virtualshelves' ) == 1 %] var MSG_BASKET_EMPTY = _("Your cart is currently empty"); var MSG_RECORD_IN_BASKET = _("The item is already in your cart"); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt index b90f6ac180..07c9f05cc7 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-recordedbooks-search.tt @@ -66,22 +66,22 @@ var querystring = "[% q |replace( "'", "\'" ) |replace( '\n', '\\n' ) |replace( var results_per_page = [% OPACnumSearchResults || 20 %]; function search( page ) { - $( '#recordedbooks-status' ).html( _("Searching RecordedBooks...") + ' ' ); + $( '#recordedbooks-status' ).html( MSG_SEARCHING.format("RecordedBooks") + ' ' ); KOHA.RecordedBooks.search( querystring, results_per_page, page, function( data ) { if ( data.error ) { - $( '#recordedbooks-status' ).html( '' + _("Error searching RecordedBooks collection") + ': ' + data.error + '' ); + $( '#recordedbooks-status' ).html( '' + MSG_ERROR_SEARCHING_COLLECTION.format("RecordedBooks") + ': ' + data.error + '' ); return; } if ( !data.total ) { - $( '#recordedbooks-status' ).html( '' + _("No results found in the library's RecordedBooks collection.") + '' ); + $( '#recordedbooks-status' ).html( '' + MSG_NO_RESULTS_FOUND_IN_COLLECTION.format("RecordedBooks") + '' ); return; } $( '#recordedbooks-results-list tbody' ).empty(); - $( '#recordedbooks-status' ).html( '' + _("Found") + ' ' + data.total + ' ' + _("results in the library's RecordedBooks collection.") + '' ); + $( '#recordedbooks-status' ).html( '' + MSG_RESULTS_FOUND_IN_COLLECTION.format(data.total, "RecordedBooks") + '' ); for ( var i = 0; data.items[i]; i++ ) { var prod = data.items[i]; @@ -94,9 +94,9 @@ function search( page ) { results.push( prod.title ); if (prod.url) results.push( '' ); results.push( '' ); - results.push( '

' + _("by") + ' ', prod.author, '

' ); + results.push( '

' + MSG_BY + ' ', prod.author, '

' ); if (prod.description) results.push( '

' + prod.description, '

' ); - results.push( '' + _("Type:") + ' ', prod.media, '' ); + results.push( '' + MSG_TYPE + ': ', prod.media, '' ); results.push( '' ); @@ -125,7 +125,7 @@ function search( page ) { if (data.total == page*results_per_page) max_page++; if ( page != 1 ) { - pages.push( '
  • « ' + _("Previous") + '
  • ' ); + pages.push( '
  • « ' + MSG_PREVIOUS + '
  • ' ); } for ( var p = Math.max( 0, page - 9 ); p <= Math.min( max_page, p + 9 ); p++ ) { @@ -137,7 +137,7 @@ function search( page ) { } if ( page < max_page ) { - pages.push( '
  • ' + _("Next") + ' »
  • ' ); + pages.push( '
  • ' + MSG_NEXT + ' »
  • ' ); } if ( pages.length > 1 ) $( '#top-pages, #bottom-pages' ).find( '.pagination' ).html( '
      ' + pages.join( '' ) + '
    '); diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js b/koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js index 5df3f3a2e9..b0aeccb29d 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/recordedbooks.js @@ -27,11 +27,11 @@ KOHA.RecordedBooks = new function() { } if (data.checkouts) { - var checkouts_div = $('
    ').html('

    ' + _("Checkouts") + '

    '); + var checkouts_div = $('
    ').html('

    ' + MSG_CHECKOUTS + '

    '); var items = data.checkouts.items; var checkouts_list; if (items.length == 0) { - checkouts_list = _("No checkouts"); + checkouts_list = MSG_NO_CHECKOUTS; } else { checkouts_list = $('