Feature: Active menu highlight, dropdown subpages, Control Panel z-index fix
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
@namespace SZUAbsolventenverein.Theme.Website
|
||||
@namespace SZUAbsolventenverein.Theme.Website
|
||||
@inherits ThemeBase
|
||||
@inject NavigationManager NavigationManager
|
||||
@inject ISettingService SettingService
|
||||
@@ -33,37 +33,59 @@
|
||||
"Search", "Privacy", "Terms", "Not Found", "NotFound"
|
||||
};
|
||||
|
||||
// Aktuelle Seite erkennen
|
||||
var currentPath = new Uri(NavigationManager.Uri).AbsolutePath.Trim('/').ToLower();
|
||||
|
||||
@foreach (var page in PageState.Pages
|
||||
.Where(p => p.ParentId == null
|
||||
&& p.IsNavigation
|
||||
&& !p.IsDeleted
|
||||
&& !hiddenNames.Contains(p.Name)))
|
||||
{
|
||||
<div class="nav-item">
|
||||
<a class="nav-link text-white" href="@(@page.Path)">
|
||||
@(@page.Name)
|
||||
</a>
|
||||
</div>
|
||||
|
||||
var pagePath = (page.Path ?? "").Trim('/').ToLower();
|
||||
var isActive = currentPath == pagePath;
|
||||
var children = PageState.Pages
|
||||
.Where(c => c.ParentId == page.PageId
|
||||
&& c.IsNavigation
|
||||
&& !c.IsDeleted
|
||||
&& !hiddenNames.Contains(c.Name));
|
||||
var hasChildren = children.Any();
|
||||
// Prüfe ob ein Kind aktiv ist
|
||||
var isChildActive = hasChildren && children.Any(c => currentPath == (c.Path ?? "").Trim('/').ToLower());
|
||||
var activeClass = (isActive || isChildActive) ? "nav-link text-white active" : "nav-link text-white";
|
||||
var wrapperClass = hasChildren ? "nav-item nav-item-dropdown" : "nav-item";
|
||||
|
||||
if (children.Any())
|
||||
{
|
||||
<div class="app-submenu">
|
||||
@foreach (var child in children)
|
||||
<div class="@wrapperClass">
|
||||
<div class="nav-link-row">
|
||||
<a class="@activeClass" href="@(@page.Path)">
|
||||
@(@page.Name)
|
||||
</a>
|
||||
@if (hasChildren)
|
||||
{
|
||||
<div class="nav-item">
|
||||
<a class="nav-link text-white" href="@child.Path">
|
||||
@child.Name
|
||||
</a>
|
||||
</div>
|
||||
<button class="dropdown-toggle-btn" onclick="var sub=this.closest('.nav-item-dropdown').querySelector('.app-submenu'); sub.classList.toggle('mobile-open'); this.querySelector('.dropdown-arrow').classList.toggle('open');">
|
||||
<span class="dropdown-arrow">▾</span>
|
||||
</button>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (hasChildren)
|
||||
{
|
||||
<div class="app-submenu">
|
||||
@foreach (var child in children)
|
||||
{
|
||||
var childPath = (child.Path ?? "").Trim('/').ToLower();
|
||||
var isThisChildActive = currentPath == childPath;
|
||||
var childActiveClass = isThisChildActive ? "nav-link text-white active" : "nav-link text-white";
|
||||
|
||||
<div class="nav-item">
|
||||
<a class="@childActiveClass" href="@child.Path">
|
||||
@child.Name
|
||||
</a>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
@@ -174,7 +196,6 @@
|
||||
|
||||
public override string Panes => PaneNames.Admin + ",Top Full Width,Top 100%,Left 50%,Right 50%,Left 33%,Center 33%,Right 33%,Left Outer 25%,Left Inner 25%,Right Inner 25%,Right Outer 25%,Left 25%,Center 50%,Right 25%,Left Sidebar 66%,Right Sidebar 33%,Left Sidebar 33%,Right Sidebar 66%,Bottom 100%,Bottom Full Width";
|
||||
|
||||
private bool _showDropdown = false;
|
||||
private bool _login = true;
|
||||
private bool _register = true;
|
||||
private bool _navOpen = false;
|
||||
|
||||
Reference in New Issue
Block a user