From aae8581b158996edac4aadae0ba487c171730c3f Mon Sep 17 00:00:00 2001 From: Armin Hasanpour Date: Mon, 11 May 2026 16:21:38 -0700 Subject: [PATCH 1/2] AB#32745 - Fixed header menu highlight on detail and configuration pages --- .../Themes/UX2/Layouts/Application.cshtml | 2 +- .../wwwroot/themes/ux2/layout.js | 29 +++++++++++++++++-- .../Pages/PaymentHistory/Details.cshtml | 3 +- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Layouts/Application.cshtml b/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Layouts/Application.cshtml index 23a1592dd7..2281df43d7 100644 --- a/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Layouts/Application.cshtml +++ b/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Layouts/Application.cshtml @@ -66,7 +66,7 @@ @await Component.InvokeLayoutHookAsync(LayoutHooks.Head.Last, StandardLayouts.Application) - +
UGM @(Assembly diff --git a/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/wwwroot/themes/ux2/layout.js b/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/wwwroot/themes/ux2/layout.js index 1e7d45f077..0e09e67257 100644 --- a/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/wwwroot/themes/ux2/layout.js +++ b/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/wwwroot/themes/ux2/layout.js @@ -84,11 +84,34 @@ $(function () { }); window.addEventListener('DOMContentLoaded', (event) => { - const currentUrl = window.location.pathname; - const currentNav = document.querySelector(`a[href="${currentUrl}"]`); + const currentUrl = window.location.pathname; + + // Exact match first + let currentNav = document.querySelector(`.unity-navbar-nav a[href="${currentUrl}"]`); + + // Fall back to longest-prefix match (handles detail/sub-pages) + if (!currentNav) { + let longestMatch = ''; + document.querySelectorAll('.unity-navbar-nav a[href]').forEach(link => { + const href = link.getAttribute('href'); + if (href && href !== '/' && href !== '#' && currentUrl.startsWith(href) && href.length > longestMatch.length) { + longestMatch = href; + currentNav = link; + } + }); + } + + // Page-level override for pages whose URL shares no prefix with their nav item + if (!currentNav) { + const activeNavHref = document.body.dataset.activeNav; + if (activeNavHref) { + currentNav = document.querySelector(`.unity-navbar-nav a[href="${activeNavHref}"]`); + } + } + if (currentNav) { currentNav.parentElement.classList.add('active'); - } + } }); document.addEventListener('DOMContentLoaded', function () { diff --git a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/PaymentHistory/Details.cshtml b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/PaymentHistory/Details.cshtml index 3e1d65dee1..557fb5bb3f 100644 --- a/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/PaymentHistory/Details.cshtml +++ b/applications/Unity.GrantManager/src/Unity.GrantManager.Web/Pages/PaymentHistory/Details.cshtml @@ -7,8 +7,9 @@ @inject IPageLayout PageLayout @{ + ViewData["ActiveNavHref"] = "/PaymentRequests"; PageLayout.Content.MenuItemName = "GrantManager.Payments"; - PageLayout.Content.Title = "Payment History"; + PageLayout.Content.Title = "Payment History"; ViewBag.PageTitle = "Payment History"; } From 1a429aeda7ca2d93aa894c6b9b1c30208da03e5b Mon Sep 17 00:00:00 2001 From: Armin Hasanpour Date: Mon, 11 May 2026 16:29:45 -0700 Subject: [PATCH 2/2] Ensure the attribute always renders. Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../src/Unity.Theme.UX2/Themes/UX2/Layouts/Application.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Layouts/Application.cshtml b/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Layouts/Application.cshtml index 2281df43d7..dd5831ac86 100644 --- a/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Layouts/Application.cshtml +++ b/applications/Unity.GrantManager/modules/Unity.Theme.UX2/src/Unity.Theme.UX2/Themes/UX2/Layouts/Application.cshtml @@ -66,7 +66,7 @@ @await Component.InvokeLayoutHookAsync(LayoutHooks.Head.Last, StandardLayouts.Application) - +
UGM @(Assembly