59 lines
1.6 KiB
Plaintext
59 lines
1.6 KiB
Plaintext
@using Microsoft.AspNetCore.Components.Routing
|
|
@using Microsoft.AspNetCore.Components.Web
|
|
@using Oqtane.Themes
|
|
@using Oqtane.Services
|
|
@using Oqtane.Models;
|
|
@using Oqtane.Security
|
|
@namespace Oqtane.Themes.Controls
|
|
@inherits ThemeObjectBase
|
|
@inject IUserService UserService
|
|
|
|
@if (menu != "")
|
|
{
|
|
@((MarkupString)menu)
|
|
}
|
|
|
|
@code {
|
|
string menu = "";
|
|
|
|
protected override void OnInitialized()
|
|
{
|
|
int level = -1;
|
|
int securitylevel = int.MaxValue;
|
|
|
|
menu = "<ul class=\"nav flex-column\">\n";
|
|
|
|
foreach (Page p in PageState.Pages.Where(item => item.IsNavigation))
|
|
{
|
|
if (UserSecurity.IsAuthorized(PageState.User, "View", p.Permissions) && p.Level <= securitylevel)
|
|
{
|
|
securitylevel = int.MaxValue;
|
|
|
|
menu += "<li class=\"nav-item px-3\">";
|
|
menu += "<a href=\"" + NavigateUrl(p.Path) + "\" class=\"nav-link\" style=\"padding-left: " + ((p.Level + 1) * 15).ToString() + "px !important;\">";
|
|
if (p.HasChildren)
|
|
{
|
|
menu += "<i class=\"oi oi-chevron-right\"></i>";
|
|
}
|
|
if (p.Icon != "")
|
|
{
|
|
menu += "<span class=\"oi " + p.Icon + "\" aria-hidden=\"true\"></span>";
|
|
}
|
|
menu += p.Name;
|
|
menu += "</a>\n";
|
|
menu += "</li>\n";
|
|
|
|
level = p.Level;
|
|
}
|
|
else
|
|
{
|
|
if (securitylevel == int.MaxValue)
|
|
{
|
|
securitylevel = p.Level;
|
|
}
|
|
}
|
|
}
|
|
menu += "</ul>";
|
|
}
|
|
}
|