Bugzilla – Attachment 144222 Details for
Bug 32307
Chocolat image viewer broken in the staff interface when Coce is enabled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32307: (follow-up) Fix gallery when Coce is enabled
Bug-32307-follow-up-Fix-gallery-when-Coce-is-enabl.patch (text/plain), 8.18 KB, created by
Jonathan Druart
on 2022-11-25 06:07:59 UTC
(
hide
)
Description:
Bug 32307: (follow-up) Fix gallery when Coce is enabled
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-11-25 06:07:59 UTC
Size:
8.18 KB
patch
obsolete
>From f2a205691624871b35faaf5eb0d4a19632eca399 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 25 Nov 2022 07:04:43 +0100 >Subject: [PATCH] Bug 32307: (follow-up) Fix gallery when Coce is enabled > >Yet another fix, this is porting the following change to the intranet: > commit 1916c644808577beb3170d642f93b456bfcc5c56 > Bug 28180: Fix bug with first image does not exist > >To recreate the problem: >Enable Coce >Go to biblionmber=5 detail >=> No image (but one is displayed on the search result) >Add a local cover image >=> Only the local cover image is displayed >Apply this patch >=> Both images are displayed >Remove the local cover image >=> Image from coce is displayed >--- > .../prog/en/modules/catalogue/detail.tt | 95 +++++++++---------- > 1 file changed, 46 insertions(+), 49 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >index ee51412cfcb..73db327146f 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt >@@ -1318,59 +1318,56 @@ Note that permanent location is a code, and location may be an authval. > // Loop over each container in the template which contains covers > $(".cover-slider").each(function(){ > var lightbox_descriptions = []; >+ var first_shown = 0; > $(this).find(".cover-image").each( function( index ){ >- var div = $(this); >- // Find the image in the container >- var img = div.find("img")[0]; >- if( $(img).length > 0 ){ >- var description = ""; >- if( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ){ >- // No image loaded in the container. Remove the slide >- div.remove(); >- } else { >- // All slides start hidden. If this is the first one, show it. >- if( index == 0 ){ >- div.show(); >- } >- // Check if Amazon image is present >- if ( div.attr("id") == "amazon-bookcoverimg" ) { >- w = img.width; >- h = img.height; >- if ((w == 1) || (h == 1)) { >- // Amazon returned single-pixel placeholder >- // Remove the container >- div.remove(); >- } else { >- lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link'))); >- } >- } else if( div.attr("id") == "custom-coverimg" ){ >- if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) { >- // No image was loaded via the CustomCoverImages system preference >- // Remove the container >- div.remove(); >- } else { >- lightbox_descriptions.push("Custom cover image"); >- } >- } else if ( div.attr("id") == "syndetics-bookcoverimg" ){ >- lightbox_descriptions.push(_("Syndetics cover image (<a href='%s'>see the original image</a>)").format($(img).data('link'))); >+ var div = $(this); >+ // Find the image in the container >+ var img = div.find("img")[0]; >+ if( $(img).length > 0 ){ >+ var description = ""; >+ // All slides start hidden. If this is the first one, show it. >+ if( first_shown == 0 ){ >+ div.show(); >+ first_shown = 1; >+ } >+ // Check if Amazon image is present >+ if ( div.attr("id") == "amazon-bookcoverimg" ) { >+ w = img.width; >+ h = img.height; >+ if ((w == 1) || (h == 1)) { >+ // Amazon returned single-pixel placeholder >+ // Remove the container >+ div.remove(); >+ } else { >+ lightbox_descriptions.push(_("Amazon cover image (<a href='%s'>see the original image</a>)").format($(img).data('link'))); > } >- else if( div.hasClass("coce-coverimg" ) ){ >- // Identify which service's image is being loaded by Coce >- var coce_description; >- if( $(img).attr("src").indexOf('amazon.com') >= 0 ){ >- coce_description = ("Coce image from Amazon.com"); >- } else if( $(img).attr("src").indexOf('google.com') >= 0 ){ >- coce_description = _("Coce image from Google Books"); >- } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){ >- coce_description = _("Coce image from Open Library"); >- } >- div.find(".hint").html(coce_description); >- lightbox_descriptions.push(coce_description); >- } else if ( div.attr("class") == "cover-image local-coverimg" ) { >- lightbox_descriptions.push(_("Local cover image (<a href='%s'>edit</a>)").format($(img).data('link'))); >+ } else if( div.attr("id") == "custom-coverimg" ){ >+ if ( (img.complete != null) && (!img.complete) || img.naturalHeight == 0 ) { >+ // No image was loaded via the CustomCoverImages system preference >+ // Remove the container >+ div.remove(); > } else { >- lightbox_descriptions.push(_("Cover image source unknown")); >+ lightbox_descriptions.push("Custom cover image"); > } >+ } else if ( div.attr("id") == "syndetics-bookcoverimg" ){ >+ lightbox_descriptions.push(_("Syndetics cover image (<a href='%s'>see the original image</a>)").format($(img).data('link'))); >+ } >+ else if( div.hasClass("coce-coverimg" ) ){ >+ // Identify which service's image is being loaded by Coce >+ var coce_description; >+ if( $(img).attr("src").indexOf('amazon.com') >= 0 ){ >+ coce_description = ("Coce image from Amazon.com"); >+ } else if( $(img).attr("src").indexOf('google.com') >= 0 ){ >+ coce_description = _("Coce image from Google Books"); >+ } else if( $(img).attr("src").indexOf('openlibrary.org') >= 0 ){ >+ coce_description = _("Coce image from Open Library"); >+ } >+ div.find(".hint").html(coce_description); >+ lightbox_descriptions.push(coce_description); >+ } else if ( div.attr("class") == "cover-image local-coverimg" ) { >+ lightbox_descriptions.push(_("Local cover image (<a href='%s'>edit</a>)").format($(img).data('link'))); >+ } else { >+ lightbox_descriptions.push(_("Cover image source unknown")); > } > } > }); >-- >2.25.1
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 32307
:
144142
|
144220
|
144222
|
144237
|
144238
|
146811
|
146812
|
147226