From 76535efc2f8019b085a7f0f27bc85f158a202def Mon Sep 17 00:00:00 2001 From: mbeaulieu Date: Fri, 8 Aug 2014 09:49:53 -0400 Subject: [PATCH] [PASSED QA] Bug 11982 - Images now display properly in the details section. If the a cover image exists, it will be displayed on the details page. Nothing is displayed of there is no cover available. modified: koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js modified: koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt Signed-off-by: Owen Leonard Signed-off-by: Katrin Fischer Works as described, passes tests and QA script. Checked Amazon covers and local covers display correctly in staff on results and detail pages. --- koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js | 5 +- .../prog/en/modules/catalogue/detail.tt | 58 +++++++++++++--------- 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js b/koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js index 8688cc9..f728d85 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/localcovers.js @@ -27,11 +27,10 @@ KOHA.LocalCover = { var img = $("").attr('src', '/cgi-bin/koha/catalogue/image.pl?thumbnail=1&biblionumber=' + $(mydiv).attr("class")) .load(function () { - if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth == 0) { + if (!this.complete || typeof this.naturalWidth == "undefined" || this.naturalWidth <= 1) { //IE HACK try { - $(mydiv).append(img); - $(mydiv).children('.no-image').remove(); + $(mydiv).remove(); } catch(err){ } 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 35edc85..6adad36 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -28,19 +28,22 @@ //= 0) || (this.src.indexOf('g-images.amazon.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com'))) { - w = this.width; - h = this.height; - if ((w == 1) || (h == 1)) { - $("#bookcoverimg").remove(); - $(".yui-gb").attr("class","yui-g"); - } else if ((this.complete != null) && (!this.complete)) { - $("#bookcoverimg").remove(); - $(".yui-gb").attr("class","yui-g"); + $("#bookcoverimg").each(function(i){ + $(this).find('img').each(function(i){ + if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com'))) { + w = this.width; + h = this.height; + if ((w == 1) || (h == 1)) { + $("#amazon-bookcoverimg").remove(); + $(".yui-gb").attr("class","yui-g"); + } else if ((this.complete != null) && (!this.complete)) { + $("#amazon-bookcoverimg").remove(); + $(".yui-gb").attr("class","yui-g"); + } } - } }); + if( $(this).find('img').length < 1 ) $(this).remove(); + }); $("#editions img").each(function(i){ if ((this.src.indexOf('images.amazon.com') >= 0) || (this.src.indexOf('g-images.amazon.com') >=0) || (this.src.indexOf('images-na.ssl-images-amazon.com'))) { w = this.width; @@ -180,9 +183,9 @@ function verify_images() { [% END %] }); - [% IF ( AmazonCoverImages ) %]$(window).load(function() { + [% IF ( AmazonCoverImages || LocalCoverImages )%]$(window).load(function() { verify_images(); - });[% END %] + });[% END %] //]]> @@ -369,17 +372,21 @@ function verify_images() { MARC Preview: Show [% IF ( holdcount ) %]Holds: [% holdcount %][% ELSE %][% END %] - [% IF ( ( AmazonEnabled && AmazonCoverImages ) || LocalCoverImages ) %] + [% IF ( AmazonCoverImages || LocalCoverImages ) %]
- [% IF ( LocalCoverImages ) %]
[% END %] - [% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %] + [% END %] [% END %] [% ELSE %] @@ -443,10 +450,13 @@ function verify_images() {
- [% IF ( ( AmazonEnabled && AmazonCoverImages ) || LocalCoverImages ) %] + [% IF ( AmazonCoverImages || LocalCoverImages ) %]
- [% IF ( LocalCoverImages ) %]
[% END %] - [% IF ( AmazonEnabled ) %][% IF ( AmazonCoverImages ) %]
+ [% IF ( LocalCoverImages ) %] +
+ [% END %] + [% IF ( AmazonCoverImages ) %] + - [% END %][% END %] + [% END %]
[% END %] -- 1.9.1