Bug 25727: Fix highlight of a missing field
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Sat, 13 Jun 2020 13:03:50 +0000 (15:03 +0200)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 24 Aug 2020 09:19:03 +0000 (11:19 +0200)
In the previous version of Select2 we had only 1 'a' tag that was
visible, next to the invisible select.

Now we have a 3 nested span elt, the last one (with a role=combobox
attribute) is the one we want to style.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

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/authorities/authorities.tt
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt

index 64f79cd..ca9b74d 100644 (file)
@@ -1552,11 +1552,11 @@ input[type='text']:read-only:focus {
 }
 
 .subfield_not_filled {
-    background-color: #FFFF99;
+    background-color: #FFFF99 !important;
 }
 
 .important_subfield_not_filled {
-    background-color : #FFFFCC;
+    background-color : #FFFFCC !important;
 }
 
 .content_hidden {
index 026f485..3fcb56c 100644 (file)
@@ -80,7 +80,14 @@ function AreMandatoriesNotOk(){
         var id_string = mandatories[i];
         // alert (id_string);
         if( ! $("#" + id_string).val() ){
-            $("#" + id_string).attr('class','subfield_not_filled').focus();
+            var elt = document.getElementById(id_string);
+            if ( elt.nodeName == 'SELECT' ) {
+                $(elt).siblings('.select2').find("span[role='combobox']").addClass('subfield_not_filled');
+            } else {
+                $(elt).addClass('subfield_not_filled');
+            }
+
+            $(elt).focus();
             StrAlert += "\t* " + _("%s in tab %s").format(label[i], tab[i]) + "\n";
         }
     }
index 66d253e..77f851e 100644 (file)
             }
             if( tabflag[tag+subfield+tagnumber][0] != 1 && (document.getElementById(subfields[i]) != null && ! document.getElementById(subfields[i]).value || document.getElementById(subfields[i]) == null)){
                 tabflag[tag+subfield+tagnumber][0] = 0 + tabflag[tag+subfield+tagnumber] ;
-                document.getElementById(subfields[i]).setAttribute('class','input_marceditor noEnterSubmit ' + notFilledClass);
+
+                var elt = document.getElementById(subfields[i]);
+                if ( elt.nodeName == 'SELECT' ) {
+                    $(elt).siblings('.select2').find("span[role='combobox']").addClass(notFilledClass);
+                } else {
+                    elt.setAttribute('class','input_marceditor noEnterSubmit ' + notFilledClass);
+                }
                 $('#' + subfields[i]).focus();
                 tabflag[tag+subfield+tagnumber][1]=label[i];
                 tabflag[tag+subfield+tagnumber][2]=tab[i];