Bug 25031: (QA follow-up) Improve handling of one or fewer images
authorOwen Leonard <oleonard@myacpl.org>
Wed, 17 Jun 2020 21:45:00 +0000 (21:45 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 24 Jul 2020 12:09:30 +0000 (14:09 +0200)
This patch addresses a few issues raised during QA:

1. If there are no images, avoid the momentary appearance of an empty
   borered box. The class controlling the appearance of the box is now
   added after initialization.
2. If there is only one image, remove the control for switching
   between covers.
3. Add "preventDefault" to cover naviation click handler.
4. Correct translation function in localcovers.js.

This patch modifies SCSS, so rebuilding the staff client CSS is
necessary for testing.

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

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
koha-tmpl/intranet-tmpl/prog/js/localcovers.js

index 5390f25..bf57675 100644 (file)
@@ -2095,7 +2095,7 @@ li {
     }
 }
 
-#cover-slides {
+.cover-slides {
     background: #FFF url("[% interface | html %]/[% theme | html %]/img/spinner-small.gif") center center no-repeat;
     border: 1px solid #b9d8d9;
     border-radius: 3px;
index 724ff28..c09ccdb 100644 (file)
@@ -986,11 +986,15 @@ Note that permanent location is a code, and location may be an authval.
                                 $(covernav).addClass("nav-active");
                             }
                             $(covernav).html("<i class=\"fa fa-circle\"></i>");
-                            $("#cover-slides").append( covernav );
+                            $("#cover-slides").addClass("cover-slides").append( covernav );
                         }
                     }
                 }
             });
+            if( $(".cover-image").length < 2 ){
+                /* Don't show controls for switching between covers if there is only 1 */
+                $(".cover-nav").remove();
+            }
             if( $(".cover-image:visible").length < 1 ){
                 $("#cover-slides").remove();
             }
@@ -1166,7 +1170,8 @@ Note that permanent location is a code, and location may be an authval.
                 link = $(this).attr("href");
                 openWindow(link,"Print spine label",400,400);
              });
-             $("#cover-slides").on("click",".cover-nav", function(){
+             $("#cover-slides").on("click",".cover-nav", function(e){
+                 e.preventDefault();
                 // Adding click handler for cover image navigation links
                 var num = $(this).data("num");
                 $(".cover-nav").removeClass("nav-active");
index a25d7c7..fe94760 100644 (file)
@@ -1,4 +1,4 @@
-/* global _ */
+/* global __ */
 
 if (typeof KOHA == "undefined" || !KOHA) {
     var KOHA = {};
@@ -43,7 +43,7 @@ KOHA.LocalCover = {
             var mydiv = this;
             var message = document.createElement("span");
             $(message).attr("class","no-image thumbnail");
-            $(message).html( _("No cover image available") );
+            $(message).html( __("No cover image available") );
             $(mydiv).append(message);
             var img = $("<img />");
             img.attr('src','/cgi-bin/koha/catalogue/image.pl?thumbnail=1&biblionumber=' + $(mydiv).attr("class"))