From 99839be1998e5095c8c8b69a523888676bb20692 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 | 19 +++++++---------- .../prog/en/includes/doc-head-close.inc | 21 +++++++++++++++++++ 3 files changed, 40 insertions(+), 11 deletions(-) diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index 72870b8b691..53ab7d3053d 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -191,4 +191,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 ecd762633c7..d5ae7b671cd 100644 --- a/koha-tmpl/intranet-tmpl/prog/css/src/_header.scss +++ b/koha-tmpl/intranet-tmpl/prog/css/src/_header.scss @@ -8,12 +8,11 @@ } #header_search { - background-color: $background-color-primary; border-radius: 0; border: 1px solid $background-color-primary; display: flex; flex-direction: column; - padding: 0; + padding: 0.6em; ul { padding: 0; @@ -22,7 +21,6 @@ display: flex; align-items: center; color: white; - background-color: $background-color-primary; z-index: 2; flex-grow: 1; @@ -67,8 +65,9 @@ label { color: white; font-weight: bold; - margin: 0; + margin: 0i auto; white-space: nowrap; + margin-bottom: 0; } } @@ -167,7 +166,6 @@ input[type="submit"], button[type="submit"] { height: 31px; - background-color: $background-color-secondary; color: white; border: 0; text-shadow: unset; @@ -220,14 +218,13 @@ > 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; &.active { border-bottom: 2px solid #FFF; @@ -241,9 +238,9 @@ } &: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; } 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 3bee910cf06..c277aaa487d 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' %] @@ -50,6 +51,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