From 424187b18ab094c87dd122c2bfa1b57ad64b93d0 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Sat, 13 Jun 2020 15:03:50 +0200 Subject: [PATCH] Bug 25727: Fix highlight of a missing field 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 Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss | 4 ++-- .../prog/en/modules/authorities/authorities.tt | 9 ++++++++- .../prog/en/modules/cataloguing/addbiblio.tt | 8 +++++++- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss index 64f79cd349..ca9b74d043 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/staff-global.scss @@ -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 { diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt index 026f48560f..3fcb56cb77 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/authorities/authorities.tt @@ -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"; } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt index 66d253e363..77f851e9a5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt @@ -334,7 +334,13 @@ } 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]; -- 2.39.5