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..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 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"; }