Bugzilla – Attachment 120448 Details for
Bug 28180
Use a lightbox gallery to display the images on the detail pages in OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28180: Reintroduce and adjust OpenLibrary
Bug-28180-Reintroduce-and-adjust-OpenLibrary.patch (text/plain), 4.64 KB, created by
PTFS Europe Sandboxes
on 2021-05-04 12:18:31 UTC
(
hide
)
Description:
Bug 28180: Reintroduce and adjust OpenLibrary
Filename:
MIME Type:
Creator:
PTFS Europe Sandboxes
Created:
2021-05-04 12:18:31 UTC
Size:
4.64 KB
patch
obsolete
>From fbf8cc5a146d9ba6e5a57edf41c0a182cb313bee Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 20 Apr 2021 14:41:34 +0200 >Subject: [PATCH] Bug 28180: Reintroduce and adjust OpenLibrary > >1. Turn on OpenLibraryCovers >2. Display the cover images in the gallery > >Sponsored-by: Gerhard Sondermann Dialog e.K. (presseplus.de, presseshop.at, presseshop.ch) > >Signed-off-by: joubu <jonathan.druart@bugs.koha-community.org> >--- > koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt | 13 +++++++++++++ > koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js | 14 +++++++++----- > 2 files changed, 22 insertions(+), 5 deletions(-) > >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 ad74cb647c..0433eb2804 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt >@@ -121,6 +121,13 @@ > </div> > [% END %] > >+ [% IF OpenLibraryCovers %] >+ <div class="cover-image" id="openlibrary-coverimg"> >+ <div title="[% img_title | html %]" class="[% normalized_isbn | html %]" id="openlibrary-thumbnail-preview" data-use-data-link="1"></div> >+ <div class="hint">Image from OpenLibrary</div> >+ </div> >+ [% END %] >+ > [% IF Koha.Preference('OPACCustomCoverImages') && Koha.Preference('CustomCoverImagesURL') %] > [% SET custom_cover_image_url = biblio.custom_cover_image_url %] > [% IF custom_cover_image_url %] >@@ -1662,6 +1669,10 @@ > KOHA.coce.getURL('[% Koha.Preference('CoceHost') | html %]', '[% Koha.Preference('CoceProviders') | html %]',[% covernewwindow | html %]); > [% END %] > >+ [% IF OpenLibraryCovers %] >+ KOHA.OpenLibrary.GetCoverFromIsbn(); >+ [% END %] >+ > function verify_images() { > // Loop over each container in the template which contains covers > $(".cover-slider").each(function(){ >@@ -1703,6 +1714,8 @@ > lightbox_descriptions.push("Image from Syndetics") > } else if( div.attr("id") == "googlejacket-coverimg" ){ > lightbox_descriptions.push(_("Image from Google Jacket (<a href='%s'>see the original image</a>)").format($(img).data('link'))); >+ } else if( div.attr("id") == "openlibrary-coverimg" ){ >+ lightbox_descriptions.push(_("Image from OpenLibrary (<a href='%s'>see the original image</a>)").format($(img).data('link'))); > } else if( div.attr("id") == "coce-coverimg" ){ > // Identify which service's image is being loaded by Coce > var coce_description; >diff --git a/koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js b/koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js >index 9ca62cb17b..8537165e72 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js >+++ b/koha-tmpl/opac-tmpl/bootstrap/js/openlibrary.js >@@ -40,15 +40,19 @@ KOHA.OpenLibrary = new function() { > var book = booksInfo[id]; > var isbn = id.substring(5); > $("[id^=openlibrary-thumbnail]."+isbn).each(function() { >- var is_opacdetail = /openlibrary-thumbnail-preview/.exec($(this).attr("id")); > var a = document.createElement("a"); > a.href = booksInfo.url; > if (book.cover) { >- var img = document.createElement("img"); >- if (is_opacdetail) { >- img.src = book.cover.medium; >- $(this).empty().append(img); >+ if ( $(this).data('use-data-link') ) { >+ var a = document.createElement("a"); >+ a.href = book.cover.large; >+ var img = document.createElement("img"); >+ img.src = book.cover.medium; >+ img.setAttribute('data-link', book.cover.large); >+ a.append(img) >+ $(this).empty().append(a); > } else { >+ var img = document.createElement("img"); > img.src = book.cover.medium; > img.height = '110'; > $(this).append(img); >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 28180
:
119918
|
119919
|
119920
|
119921
|
119922
|
119923
|
119924
|
120444
|
120445
|
120446
|
120447
|
120448
|
120449
|
120450
|
120464
|
120465
|
120466
|
120467
|
120468
|
120469
|
120470
|
120753
|
120754
|
120805
|
122783
|
122784
|
123178
|
123790
|
123792
|
123793
|
123794
|
124819
|
125666
|
126041
|
126042
|
126506
|
126507
|
126508
|
126509
|
126510
|
126511
|
126512
|
126513
|
126514
|
126515
|
126516
|
126517
|
126518
|
126519
|
126520
|
126596
|
126597
|
126598
|
126599
|
126600
|
126601
|
126602
|
126603
|
126604
|
126605
|
126606
|
126607
|
126608
|
126609
|
126610