IW4M-Admin/WebfrontCore/Views/Shared/_LeftNavBar.cshtml

238 lines
12 KiB
Plaintext
Raw Normal View History

2022-04-19 19:43:58 -04:00
@using SharedLibraryCore.Configuration
@using SharedLibraryCore.Dtos
@using Data.Models.Client
@using SharedLibraryCore.Interfaces
2022-04-19 19:43:58 -04:00
<!-- left side navigation -->
<div class="sidebar-overlay" onclick="halfmoon.toggleSidebar()"></div>
<div class="sidebar">
<div class="sidebar-menu list">
<div class="sidebar-content m-0">
<div class="pr-20 pl-20 mb-20 d-block d-lg-none">
2023-01-23 17:38:16 -05:00
<partial name="_SearchResourceForm" model="@("Compact")"/>
2022-04-19 19:43:58 -04:00
</div>
2022-07-05 13:02:43 -04:00
<span class="sidebar-title">@ViewBag.Localization["WEBFRONT_NAV_TITLE_MAIN"]</span>
2022-04-19 19:43:58 -04:00
<div class="sidebar-divider"></div>
<!-- servers -->
<a asp-controller="Home" asp-action="Index" class="sidebar-link">
<i class="oi oi-hard-drive mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_SERVERS"]</span>
</a>
<!-- about -->
<a asp-controller="About" asp-action="Index" class="sidebar-link">
<i class="oi oi-info mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_ABOUT"]</span>
</a>
<!-- penalties -->
<has-permission entity="Penalty" required-permission="Read">
<a asp-controller="Penalty" asp-action="List" class="sidebar-link">
<i class="oi oi-lock-locked mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_PENALTIES"]</span>
</a>
</has-permission>
2022-04-19 19:43:58 -04:00
<!-- privileged -->
<has-permission entity="PrivilegedClientsPage" required-permission="Read">
<a asp-controller="Client" asp-action="Privileged" class="sidebar-link">
<i class="oi oi-people mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_PRIVILEGED"]</span>
</a>
</has-permission>
<!-- help -->
<has-permission entity="HelpPage" required-permission="Read">
<a asp-controller="Home" asp-action="Help" class="sidebar-link">
<i class="oi oi-question-mark mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_HELP"]</span>
</a>
</has-permission>
@foreach (IInteractionData interactionData in ViewBag.Interactions)
{
if (!interactionData.InteractionId.StartsWith("Webfront::Nav::Main"))
{
continue;
}
if (ViewBag.User.Level >= interactionData.MinimumPermission)
{
<a asp-controller="Interaction" asp-action="Render" asp-route-interactionName="@interactionData.InteractionId" class="sidebar-link">
<i class="oi @interactionData.DisplayMeta mr-5"></i>
<span class="name">@interactionData.Name</span>
</a>
}
}
2022-04-19 19:43:58 -04:00
<!-- profile -->
<has-permission entity="ProfilePage" required-permission="Read">
<a asp-controller="Client" asp-action="Profile" asp-route-id="@ViewBag.User.ClientId" class="sidebar-link">
<i class="oi oi-person mr-5"></i>
2022-07-05 13:02:43 -04:00
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_TITLE_PROFILE"]</span>
2022-04-19 19:43:58 -04:00
</a>
</has-permission>
@if (!ViewBag.Authorized)
{
<a href="#actionModal" class="profile-action sidebar-link" data-action="login">
<i class="oi oi-key mr-5"></i>
2022-07-05 13:02:43 -04:00
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_TITLE_LOGIN"]</span>
2022-04-19 19:43:58 -04:00
</a>
}
<br/>
<!-- stats -->
2022-07-05 13:02:43 -04:00
<div class="sidebar-title ">@ViewBag.Localization["WEBFRONT_NAV_TITLE_STATS"]</div>
2022-04-19 19:43:58 -04:00
<div class="sidebar-divider"></div>
@foreach (Page pageLink in ViewBag.Pages)
{
<a class="sidebar-link" href="@pageLink.Location">
2022-04-22 18:29:29 -04:00
<i class="oi @(pageLink.Location.EndsWith("Radar") ? "oi-wifi" : "oi-bar-chart") mr-5"></i>
2022-04-19 19:43:58 -04:00
<span class="name">@pageLink.Name</span>
</a>
}
<!-- scoreboard -->
<a asp-controller="Server" asp-action="Scoreboard" class="sidebar-link">
<i class="oi oi-spreadsheet mr-5"></i>
2022-07-05 13:02:43 -04:00
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_TITLE_SCOREBOARD"]</span>
2022-04-19 19:43:58 -04:00
</a>
<br/>
<!-- socials -->
@if (ViewBag.CommunityInformation?.IsEnabled && ViewBag.CommunityInformation.SocialAccounts.Length > 0)
{
2022-07-05 13:02:43 -04:00
<span class="sidebar-title">@ViewBag.Localization["WEBFRONT_NAV_TITLE_SOCIALS"]</span>
2022-04-19 19:43:58 -04:00
<div class="sidebar-divider"></div>
}
@foreach (var social in ViewBag.CommunityInformation?.SocialAccounts ?? Array.Empty<SocialAccountConfiguration>())
{
<a href="@social.Url" class="sidebar-link" target="_blank" title="@social.Title">
<div class="d-flex align-items-center">
@if (!string.IsNullOrWhiteSpace(social.IconId))
{
<i class="oi @social.IconId align-self-center"></i>
}
else if (!string.IsNullOrWhiteSpace(social.IconUrl))
{
var url = Uri.TryCreate(social.IconUrl, UriKind.Absolute, out Uri parsedUrl)
? parsedUrl.AbsoluteUri
: $"/images/community/{social.IconUrl}";
<img class="img-fluid social-icon align-self-center" src="@url" alt="@social.Title"/>
}
<div class="name text-truncate align-self-center">@social.Title</div>
</div>
2022-04-19 19:43:58 -04:00
</a>
}
@foreach (IInteractionData interactionData in ViewBag.Interactions)
{
if (!interactionData.InteractionId.StartsWith("Webfront::Nav::Social"))
{
continue;
}
if (ViewBag.User.Level >= interactionData.MinimumPermission)
{
<a asp-controller="Interaction" asp-action="Render" asp-route-interactionName="@interactionData.InteractionId" class="sidebar-link">
<i class="oi @interactionData.DisplayMeta mr-5"></i>
<span class="name">@interactionData.Name</span>
</a>
}
}
2022-04-19 19:43:58 -04:00
<br/>
<!-- admin -->
<has-permission entity="AdminMenu" required-permission="Read">
2022-07-05 13:02:43 -04:00
<div class="sidebar-title">@ViewBag.Localization["WEBFRONT_NAV_TITLE_ADMIN"]</div>
2022-04-19 19:43:58 -04:00
<div class="sidebar-divider"></div>
<has-permission entity="ConsolePage" required-permission="Read">
<a asp-controller="Console" asp-action="Index" class="sidebar-link">
<i class="oi oi-terminal mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_CONSOLE"]</span>
</a>
</has-permission>
2022-06-05 17:27:56 -04:00
<has-permission entity="Penalty" required-permission="Read"></has-permission>
<a asp-controller="Admin" asp-action="BanManagement" class="sidebar-link">
<i class="oi oi-ban mr-5"></i>
2022-07-05 13:02:43 -04:00
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_TITLE_BAN_MANAGEMENT"]</span>
2022-06-05 17:27:56 -04:00
</a>
</has-permission>
@if (ViewBag.User.Level >= EFClient.Permission.Owner)
{
<a asp-controller="Configuration" asp-action="Edit" class="sidebar-link">
<i class="oi oi-cog mr-5"></i>
2022-07-05 13:02:43 -04:00
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_TITLE_CONFIGURATION"]</span>
2022-06-05 17:27:56 -04:00
</a>
}
<has-permission entity="AuditPage" required-permission="Read">
<a asp-controller="Admin" asp-action="AuditLog" class="sidebar-link">
<i class="oi oi-book mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_AUDIT_LOG"]</span>
2022-04-19 19:43:58 -04:00
</a>
</has-permission>
2022-06-05 17:27:56 -04:00
<has-permission entity="RecentPlayersPage" required-permission="Read">
<a class="sidebar-link profile-action" href="#actionModal" data-action="RecentClients" title="@ViewBag.Localization["WEBFRONT_ACTION_RECENT_CLIENTS"]">
<i class="oi oi-timer mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_ACTION_RECENT_CLIENTS"]</span>
</a>
</has-permission>
@foreach (IInteractionData interactionData in ViewBag.Interactions)
{
if (!interactionData.InteractionId.StartsWith("Webfront::Nav::Admin"))
{
continue;
}
if (ViewBag.User.Level >= interactionData.MinimumPermission)
{
<a asp-controller="Interaction" asp-action="Render" asp-route-interactionName="@interactionData.InteractionId" class="sidebar-link">
<i class="oi @interactionData.DisplayMeta mr-5"></i>
<span class="name">@interactionData.Name</span>
</a>
}
}
2022-07-05 13:02:43 -04:00
2022-04-19 19:43:58 -04:00
@if (ViewBag.Authorized)
{
<a class="sidebar-link profile-action" href="#actionModal" data-action="GenerateLoginToken" data-response-duration="30000" title="@ViewBag.Localization["WEBFRONT_ACTION_TOKEN"]">
<i class="oi oi-key mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_ACTION_TOKEN"]</span>
</a>
2022-04-19 19:43:58 -04:00
<a asp-controller="Account" asp-action="Logout" class="sidebar-link">
<i class="oi oi-account-logout mr-5"></i>
<span class="name">@ViewBag.Localization["WEBFRONT_NAV_LOGOUT"]</span>
</a>
}
<br/>
<!-- version -->
<div class="sidebar-link font-size-12 font-weight-light">
@if (ViewBag.Authorized)
{
2022-07-05 13:02:43 -04:00
@foreach (var match in Utilities.SplitTranslationTokens(ViewBag.Localization["WEBFRONT_NAV_LOGIN_YES_FORMAT"]))
{
if (match.IsInterpolation && match.MatchValue == "username")
{
<color-code value="@ViewBag.User.Name"></color-code>
}
else
{
<span>@match.MatchValue</span>
}
}
2022-04-19 19:43:58 -04:00
}
else
{
2022-07-05 13:02:43 -04:00
<span>@ViewBag.Localization["WEBFRONT_NAV_LOGIN_NO_FORMAT"]</span>
2022-04-19 19:43:58 -04:00
}
</div>
<div class="sidebar-divider mt-0 mb-0"></div>
<a href="https://github.com/RaidMax/IW4M-Admin/releases" class="sidebar-link" target="_blank">
<span class="name font-size-12 font-weight-light">IW4MAdmin <span class="text-primary">@Program.Manager.Version</span></span>
</a>
</div>
</div>
</div>