From f7926629d6e9b803ed92211f2eb14a8c1cbf9bf7 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 2 Nov 2020 18:13:04 +0000 Subject: [PATCH] Bug 26148: OpenLibrary "Preview" link target is unclear to patrons This patch makes changes to the display of the Open Library "read" links in the OPAC search results and detail page. The link is now grouped with other details about the record ("Publisher," "Location(s)," etc. On the detail page, the "Preview" link will no longer appear under the cover image. The label is changed to "Found in Open Library," and the link now opens the Open Library reader in a new window. The patch also changes the Open Library button image links so that they use https and makes it so that the "Found in Open Library" information is hidden until the availability information has loaded. To test, apply the patch and enable the OpenLibrarySearch system preference. - Perform a search in the OPAC which will return results found in Open Library, e.g. "poetry" in the sample data. - Confirm that the "Read now" images from Open Library appear on some search results. - View the detail page for one of these titles. - Confirm that the "Read now" button appears in the same format on the detail page. --- koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc | 1 - .../opac-tmpl/bootstrap/en/includes/openlibrary-readapi.inc | 2 +- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt | 6 +++--- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt | 5 +++-- koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js | 13 +++++++------ 5 files changed, 14 insertions(+), 13 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 1641593395..03372af8d1 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc @@ -207,7 +207,6 @@ $.widget.bridge('uitooltip', $.ui.tooltip); [% END %] [% IF OpenLibraryCovers || OpenLibrarySearch %] var NO_OL_JACKET = _("No cover image available"); - var OL_PREVIEW = _("Preview"); [% END %] [% IF (query_desc) %] var query_desc = "[% query_desc | html %]"; diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/openlibrary-readapi.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/openlibrary-readapi.inc index d7fee6c3f6..3b4c74811e 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/openlibrary-readapi.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/openlibrary-readapi.inc @@ -1,4 +1,4 @@ [%# Input params: bib - search result biblio record %] [% IF OpenLibrarySearch && ( bib.normalized_isbn || bib.lccn || bib.normalized_oclc ) %] -
Open Library:
+ [% END %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt index a88a7caf0b..4e0d27de9e 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt @@ -418,6 +418,9 @@ [% END # / IF SyndeticsAwards && SyndeticsAWARDS1Exists %] [% END # / IF SyndeticsEnabled%] + [%# Following on one line due to translation issues %] + [% INCLUDE "openlibrary-readapi.inc" bib = { normalized_isbn => normalized_isbn,lccn => lccn, normalized_oclc => normalized_oclc } %] + [% IF ( OpacStarRatings != 'disable' ) %]
@@ -1043,9 +1046,6 @@
[% END # / IF Babeltheque %] - [%# Following on one line due to translation issues %] - [% INCLUDE "openlibrary-readapi.inc" bib = { normalized_isbn => normalized_isbn,lccn => lccn, normalized_oclc => normalized_oclc } %] -
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 b8d86ee9a7..206f360412 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt @@ -547,6 +547,8 @@ [% END %] + [% INCLUDE "openlibrary-readapi.inc" bib = SEARCH_RESULT %] + [% IF ( OpacStarRatings == 'all' ) %]
[% SET rating_avg = SEARCH_RESULT.ratings.get_avg_rating() %] @@ -573,10 +575,9 @@
[% END # / IF OpacStarRatings %] - [% INCLUDE 'title-actions-menu.inc' items=SEARCH_RESULT %] + [% INCLUDE 'title-actions-menu.inc' items=SEARCH_RESULT %]
- [% INCLUDE "openlibrary-readapi.inc" bib = SEARCH_RESULT %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js b/koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js index afd6e4c77a..9ca62cb17b 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js +++ b/koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js @@ -48,7 +48,6 @@ KOHA.OpenLibrary = new function() { if (is_opacdetail) { img.src = book.cover.medium; $(this).empty().append(img); - $(this).append(''); } else { img.src = book.cover.medium; img.height = '110'; @@ -150,11 +149,11 @@ function create_query() { function make_read_button(bookdata) { buttons = { 'full access': - "http://openlibrary.org/images/button-read-open-library.png", + "https://openlibrary.org/images/button-read-open-library.png", 'lendable': - "http://openlibrary.org/images/button-borrow-open-library.png", + "https://openlibrary.org/images/button-borrow-open-library.png", 'checked out': - "http://openlibrary.org/images/button-checked-out-open-library.png" + "https://openlibrary.org/images/button-checked-out-open-library.png" }; if (bookdata.items.length == 0) { return false; @@ -163,9 +162,10 @@ function make_read_button(bookdata) { if (!(first.status in buttons)) { return false; } - result = '' + + result = '' + ''; + console.log( result ); return result; } @@ -179,8 +179,9 @@ function default_decorate_el_fn(el, bookdata) { } if (decoration) { el.innerHTML += decoration; + el.style.display = 'block' } else { - el.style.visibility = 'hidden'; + el.style.display = 'none'; } } -- 2.11.0