From 680bf6af2faa3b1612e16f77ec58daf129ef431a Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 27 Jun 2023 12:38:09 +0000 Subject: [PATCH] Bug 34131: Add 'current' class on correct side menu link This changes the way we're looking for the correct menu item to set as active. If we don't find an exact match for path+params, we attempt to set 'current' to just matching on path. What this does is it sets the 'Plugins' menu item as active, even if the url is 'plugins-home.pl?method=report Signed-off-by: Owen Leonard Signed-off-by: Jonathan Druart Signed-off-by: Tomas Cohen Arazi --- koha-tmpl/intranet-tmpl/prog/js/staff-global.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js index 02bc39b8f8..74af1ad89a 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/staff-global.js +++ b/koha-tmpl/intranet-tmpl/prog/js/staff-global.js @@ -144,7 +144,11 @@ $(document).ready(function() { if ( url.match(/\?(.+)$/) ) { params = "?" + RegExp.$1; } - $("a[href$=\"/" + path + params + "\"]", navmenulist).addClass("current"); + if ($("a[href$=\"/" + path + params + "\"]", navmenulist).length == 0){ + $("a[href$=\"/" + path + "\"]", navmenulist).addClass("current"); + } else { + $("a[href$=\"/" + path + params + "\"]", navmenulist).addClass("current"); + } } $("#catalog-search-link a").on("mouseenter mouseleave", function(){ -- 2.39.5