Browse Source

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.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
20.11.x
Owen Leonard 9 months ago
committed by Jonathan Druart
parent
commit
f11659c48b
  1. 1
      koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
  2. 2
      koha-tmpl/opac-tmpl/bootstrap/en/includes/openlibrary-readapi.inc
  3. 6
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
  4. 5
      koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
  5. 13
      koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js

1
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 %]";

2
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 ) %]
<div class="ol_readapi_book" isbn="[% bib.normalized_isbn | html %]" lccn="[% bib.lccn | html %]" oclc="[% bib.normalized_oclc | html %]">Open Library: </div>
<div class="results_summary ol_readapi_book" isbn="[% bib.normalized_isbn | html %]" lccn="[% bib.lccn | html %]" oclc="[% bib.normalized_oclc | html %]" style="display:none"><span class="label">Found in Open Library:</span> </div>
[% END %]

6
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' ) %]
<form method="post" action="/cgi-bin/koha/opac-ratings.pl">
<div class="results_summary ratings">
@ -1043,9 +1046,6 @@
</div>
[% 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 } %]
</div> <!-- /.col-lg-10 -->
<div class="col-lg-3">

5
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt

@ -547,6 +547,8 @@
</span>
[% END %]
[% INCLUDE "openlibrary-readapi.inc" bib = SEARCH_RESULT %]
[% IF ( OpacStarRatings == 'all' ) %]
<div class="results_summary ratings">
[% SET rating_avg = SEARCH_RESULT.ratings.get_avg_rating() %]
@ -573,10 +575,9 @@
</div> <!-- / .results_summary -->
[% END # / IF OpacStarRatings %]
[% INCLUDE 'title-actions-menu.inc' items=SEARCH_RESULT %]
[% INCLUDE 'title-actions-menu.inc' items=SEARCH_RESULT %]
</div>
[% INCLUDE "openlibrary-readapi.inc" bib = SEARCH_RESULT %]
</td>
</tr>

13
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('<div class="results_summary">' + '<a href="' + book.url + '">' + OL_PREVIEW + '</a></div>');
} 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 = '<a href="' + first.itemURL + '">' +
result = '<a target="_blank" href="' + first.itemURL + '">' +
'<img class="' + ol_button_classname +
'" src="' + buttons[first.status] + '"/></a>';
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';
}
}

Loading…
Cancel
Save