From bc8737167cafa5cd3f9300af574b9e91a24ded54 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Fri, 7 Jun 2024 21:55:10 +0000 Subject: [PATCH] Bug 37054: Adjust header colors if branches.branchcolor is used To test: 1. Apply patch, update database, restart services, yarn build 2. Go to Administration > Libraries 3. Edit or create a new branch. 4. You should now see a 'Branch color' option. 5. Set that to anything you want. 6. Log in as that branch. 7. Your header color should now relect that choice. 8. Log in to another branch without a set branch color. 9. The header should remain the default green. Signed-off-by: David Nind --- Koha/Template/Plugin/Branches.pm | 11 ++++++++ .../intranet-tmpl/prog/css/src/_header.scss | 25 ++++++++----------- .../prog/en/includes/doc-head-close.inc | 21 ++++++++++++++++ 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index 7090530f38..2bc02a8255 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -175,4 +175,15 @@ sub GetBranchSpecificCSS { return $opacusercss; } +sub GetBranchColor { + my ( $self, $branchcode ) = @_; + + return q{} unless defined $branchcode; + + my $library = Koha::Libraries->find($branchcode); + my $branchcolor = $library ? $library->branchcolor : q{}; + + return $branchcolor; +} + 1; diff --git a/koha-tmpl/intranet-tmpl/prog/css/src/_header.scss b/koha-tmpl/intranet-tmpl/prog/css/src/_header.scss index 4ebef0ba1d..cddd3543e3 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/_header.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/_header.scss @@ -52,11 +52,10 @@ a.navbar-toggle { } #header_search { - background-color: $background-color-primary; border-radius: 0; border: 1px solid $background-color-primary; display: flex; - padding: 0 .8em; + padding: 0.6em; ul { padding: 0; @@ -65,7 +64,6 @@ a.navbar-toggle { display: flex; align-items: center; color: white; - background-color: $background-color-primary; z-index: 2; flex-grow: 1; @@ -97,9 +95,8 @@ a.navbar-toggle { } .form-title { - padding: 0 16px 0 0; - background-color: $background-color-primary; - border-radius: 0 16px 16px 0; + padding: 0 16px; + border-radius: 16px; display: flex; align-items: center; justify-content: flex-end; @@ -110,8 +107,9 @@ a.navbar-toggle { label { color: white; font-weight: bold; - margin: 0; + margin: 0i auto; white-space: nowrap; + margin-bottom: 0; } } @@ -210,7 +208,6 @@ a.navbar-toggle { input[type="submit"], button[type="submit"] { height: 31px; - background-color: $background-color-secondary; color: white; border: 0; text-shadow: unset; @@ -256,19 +253,17 @@ a.navbar-toggle { > li { > a { - background-color: $background-color-primary; - border: 2px solid $background-color-primary; + border: 2px solid; border-radius: 0; color: #FFF; font-weight: normal; line-height: 1.3; margin: 0 .25em; - padding: 0 .25em; + padding: .25em .5em; &:hover, &:focus, &:active { - background-color: $background-color-primary; - border: 2px solid $background-color-primary; - border-bottom-color: $background-color-secondary; + border: 2px solid; + border-bottom-color: currentColor; border-bottom: 0; padding: 0 .25em; text-decoration: none; @@ -279,7 +274,7 @@ a.navbar-toggle { a { cursor: default; padding: 0 .25em; - border-bottom: 2px solid #FFF; + border-bottom: 2px solid currentColor !important; &:hover, &:focus { 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 60264eb4bb..ee9aec3ff3 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 @@ -3,6 +3,7 @@ [% USE Koha %] [% USE KohaPlugins %] [% USE String %] +[% USE Branches %] [% PROCESS 'html_helpers.inc' %] @@ -52,6 +53,26 @@ var Koha = {}; [% IF ( login ) %] [% Asset.css("css/login.css") | $raw %] [% END %] +[% SET branchcolor = Branches.GetBranchColor( Branches.GetLoggedInBranchcode() ) || '#408540' %] + [% IF ( IntranetUserCSS ) %][% END %] [% KohaPlugins.get_plugins_intranet_head | $raw %] -- 2.39.2