Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@

@await Component.InvokeLayoutHookAsync(LayoutHooks.Head.Last, StandardLayouts.Application)
</head>
<body class="abp-application-layout @rtl">
<body class="abp-application-layout @rtl" data-active-nav="@(ViewData["ActiveNavHref"] ?? string.Empty)">
<div id="app-version-id">
<div>
UGM @(Assembly
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}

Expand Down
Loading