Files
MoneyMap/MoneyMap/wwwroot/js/site.js
AJ Isaacs 4be5658d32 Improve: Overhaul navigation with grouped dropdowns, breadcrumbs, and quick-actions
Restructure the flat 7-item navbar into logical dropdown groups (Transactions,
Receipts, Accounts), add a prominent Upload button, settings gear icon, breadcrumb
navigation on 11 deep pages, and dashboard quick-action cards with hover effects.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 19:41:56 -05:00

20 lines
957 B
JavaScript

// Highlight active dropdown parent when a child page is active
(function () {
var path = window.location.pathname.toLowerCase().replace(/\/+$/, '') || '/';
document.querySelectorAll('.navbar .dropdown-menu .dropdown-item').forEach(function (item) {
var href = (item.getAttribute('href') || '').toLowerCase().replace(/\/+$/, '');
if (href && (path === href || path.startsWith(href + '/'))) {
item.classList.add('active');
var toggle = item.closest('.dropdown').querySelector('.dropdown-toggle');
if (toggle) toggle.classList.add('active-parent');
}
});
// Direct nav-links (non-dropdown)
document.querySelectorAll('.navbar .nav-link:not(.dropdown-toggle)').forEach(function (link) {
var href = (link.getAttribute('href') || '').toLowerCase().replace(/\/+$/, '');
if (href && path === href) {
link.classList.add('active');
}
});
})();