From 1562ff7c111e6faf4dfb3d932e0659cab83ae688 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 5 Mar 2021 15:19:40 +0000 Subject: [PATCH] Bug 27882: Move external search results links out of page heading This patch modifies the JavaScript which adds search result information to the OPAC search results page which is returned from OverDrive, Recorded Books, or Open Library. The information now displays below the page heading instead of inside it. To test you must have OpenLibrarySearch enabled, OverDrive-related preferences populated (OverDriveClientKey, OverDriveClientSecret, OverDriveLibraryID), or RecordedBooks preferences (RecordedBooksClientSecret, RecordedBooksDomain, RecordedBooksLibraryID). This patch was written with OverDrive and Open Library results active. - Apply the patch and perform a search in the OPAC catalog. - On the search results page you should see results for your external services appear below the page heading ("You search returned..."), e.g. "Found 20257 results in the library's OpenLibrary collection" "Found 337 results in the library's OverDrive collection" Signed-off-by: Lucas Gass Signed-off-by: Martin Renvoize --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt index 361103afea..cc22a13e57 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -921,8 +921,7 @@ [% END # /IF OpacHighlightedWords %] [% IF ( OverDriveEnabled ) %] var $overdrive_results = $( '
' + MSG_SEARCHING.format('OverDrive') + '
' ); - $( '#numresults' ) .append( ' ' ) - .append( $overdrive_results ); + $( '#numresults' ) .after( $overdrive_results ); //Clean querystring, first we remove CCL entities, then decode HTML entities, then swap double quotes for single quotes //as the overdrive API treats double quotes as a search term and returns extra results od_querystring = querystring.replace(/(?:^|\W)([\w-]+)(,[\w-]+)*([:=])/g,' '); @@ -943,8 +942,7 @@ [% END # /IF OverDriveEnabled %] [% IF ( RecordedBooksEnabled ) %] var $recordedbooks_results = $( '
' + MSG_SEARCHING.format('RecordedBooks') + '
' ); - $( '#numresults' ) .append( ' ' ) - .append( $recordedbooks_results ); + $( '#numresults' ) .after( $recordedbooks_results ); KOHA.RecordedBooks.search( querystring, [% OPACnumSearchResults || "null" | html %], null, function( data ) { if ( data.error ) { $recordedbooks_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('RecordedBooks') + ': ' + data.error); @@ -961,8 +959,7 @@ [% END # /IF RecordedBooksEnabled %] [% IF ( OpenLibrarySearch ) %] var $openlibrary_results = $( '
' + MSG_SEARCHING.format('OpenLibrary' ) + '
' ); - $( '#numresults' ) .append( ' ' ) - .append( $openlibrary_results ); + $( '#numresults' ) .after( $openlibrary_results ); KOHA.OpenLibrary.search( querystring, null, function( data ) { if ( data.error ) { $openlibrary_results.html( MSG_ERROR_SEARCHING_COLLECTION.format('OpenLibrary') ); -- 2.20.1