Bug 25007: (follow-up) Fix the way image check alters layout

A question in the bug report asks: Why is is necessary to change the
Bootstrap class to col-xs-12? The JavaScript which checks for the
existence of an Amazon cover image is designed to remove the Amazon
cover's container if there is none. Changing the class of
cover image column is gone.

However, the check is incorrect because it doesn't account for Local
Covers. There might be both a 1 x 1 pixel Amazon image and a local cover
image, so the layout shouldn't be changed unless there are no images
present.

To test, apply the patch and view the bibliographic details page of
various titles including:
- Amazon cover present, no local cover
- No Amazon cover, local cover image present
- Both Amazon and local cover image

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Joy Nelson <joy@bywatersolutions.com>
This commit is contained in:
Owen Leonard 2020-03-28 17:42:50 +00:00 committed by Joy Nelson
parent 8c09c5ee80
commit 05c4248721
1 changed files with 4 additions and 3 deletions

View File

@ -813,14 +813,15 @@
h = this.height;
if ((w == 1) || (h == 1)) {
$("#amazon-bookcoverimg").remove();
$("#catalogue_detail_biblio").attr("class","col-xs-12");
} else if ((this.complete != null) && (!this.complete)) {
$("#amazon-bookcoverimg").remove();
$("#catalogue_detail_biblio").attr("class","col-xs-12");
}
}
});
if( $(this).find('img').length < 1 ) $(this).remove();
if( $(this).find('img').length < 1 ){
$(this).remove();
$("#catalogue_detail_biblio").attr("class","col-xs-12");
}
});
$("#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'))) {