From 41e290cf86fb620e6d746a75f077f66754d1427e Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Mon, 10 Jun 2024 15:42:12 +0000 Subject: [PATCH] Bug 37054: (follow-up) Simplify changes, add a way to clear the color field This patch cuts some of the CSS changes which I think were unnecessary and adds a way for the user to clear the color field. A text input now shows the selected hex colur value and the "Clear" button clears it. I've changed the way the patch handles the custom colors by making the color handling dependent on there being a branchcolor value. This way we don't have to alter the existing header CSS, just override it if a custom color has been chosen. To test, apply the patch and test that the color picker still works correctly and that the "Clear" button works to empty the field. Test the appearance of the search bar in a branch with a custom color and in a branch without. Signed-off-by: David Nind Signed-off-by: Laura_Escamilla --- .../intranet-tmpl/prog/css/src/_header.scss | 14 ++++---- .../prog/en/includes/doc-head-close.inc | 35 +++++++++---------- .../prog/en/modules/admin/branches.tt | 16 +++++++-- 3 files changed, 38 insertions(+), 27 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/_header.scss b/koha-tmpl/intranet-tmpl/prog/css/src/_header.scss index 688d9f7927..4b0d1d7ff9 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/_header.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/_header.scss @@ -8,11 +8,12 @@ } #header_search { + background-color: $background-color-primary; border-radius: 0; border: 1px solid $background-color-primary; display: flex; flex-direction: column; - padding: 0.6em; + padding: 0 .8em; ul { padding: 0; @@ -21,6 +22,7 @@ display: flex; align-items: center; color: white; + background-color: $background-color-primary; z-index: 2; flex-grow: 1; @@ -65,9 +67,8 @@ label { color: white; font-weight: bold; - margin: 0i auto; + margin: 0; white-space: nowrap; - margin-bottom: 0; } } @@ -166,6 +167,7 @@ input[type="submit"], button[type="submit"] { height: 31px; + background-color: $background-color-secondary; color: white; border: 0; text-shadow: unset; @@ -218,13 +220,14 @@ > li { > a { - border: 2px solid; + background-color: $background-color-primary; + border: 2px solid $background-color-primary; border-radius: 0; color: #FFF; font-weight: normal; line-height: 1.3; margin: 0 .25em; - padding: .25em .5em; + padding: 0 .25em; &.active { border-bottom: 2px solid #FFF; @@ -238,7 +241,6 @@ } &:hover, &:focus, &:active { - border: 2px solid; border-bottom-color: currentColor; border-bottom: 0; padding: 0 .25em; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc index c277aaa487..27b943eb4b 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/doc-head-close.inc @@ -51,26 +51,23 @@ var Koha = {}; [% IF ( login ) %] [% Asset.css("css/login.css") | $raw %] [% END %] -[% SET branchcolor = Branches.GetBranchColor( Branches.GetLoggedInBranchcode() ) || '#408540' %] - + #header_search button[type="submit"] { + background: [% branchcolor | html %]; + filter: brightness(160%); + } + +[% END %] [% IF ( IntranetUserCSS ) %][% END %] [% KohaPlugins.get_plugins_intranet_head | $raw %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt index 32a2d58a88..28cabc4b2a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/branches.tt @@ -367,8 +367,10 @@
  • - - + + + + Clear
  • @@ -875,6 +877,16 @@ } $( "#" + target ).hide(); }); + + $("#colorpicker").on("change", function(){ + let branchcolor = this.value; + $("#branchcolor").val( branchcolor ); + }); + + $(".clear_color").on("click", function(e){ + e.preventDefault(); + $("#branchcolor, #colorpicker").val( "" ); + }); [% END %] -- 2.39.5