Files
ZelWiki/TightWiki/Views/Admin/Namespaces.cshtml
2025-01-22 23:31:03 +08:00

58 lines
1.9 KiB
Plaintext

@model TightWiki.Models.ViewModels.Admin.NamespacesViewModel
@using TightWiki.Library
@using TightWiki.Models
@{
Layout = "/Views/Shared/_Layout.cshtml";
var sessionState = ViewData["SessionState"] as TightWiki.SessionState ?? throw new Exception("Wiki State Context cannot be null.");
}
<h3>
Namespaces
</h3>
<p>
All namespaces contained in the wiki.<br /><br />
</p>
@if (!string.IsNullOrEmpty(Model.ErrorMessage))
{
<div class="alert alert-danger">@Html.Raw(Model.ErrorMessage)</div>
}
@if (!string.IsNullOrEmpty(Model.SuccessMessage))
{
<div class="alert alert-success">@Html.Raw(Model.SuccessMessage)</div>
}
@using (Html.BeginForm(null, null, FormMethod.Get, new { action = $"{GlobalConfiguration.BasePath}{Context.Request.Path}" }))
{
@if (Model.Namespaces.Count > 0)
{
<table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Name")">Name</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Pages")">Pages</a></strong></td>
</tr>
</thead>
@foreach (var p in Model.Namespaces)
{
<tr>
<td><a href="@GlobalConfiguration.BasePath/Admin/Namespace/@(p.Namespace?? string.Empty)">@(string.IsNullOrEmpty(p.Namespace) ? "(Default)" : p.Namespace)</a></td>
<td>@p.CountOfPages.ToString("N0")</td>
</tr>
}
</table>
@Html.Raw(TightWiki.Library.PageSelectorGenerator.Generate(Context.Request.QueryString, Model.PaginationPageCount))
}
else
{
<div class="d-flex small text-muted mb-0">
<strong>
There are currently no pages which exist within namespaces.
</strong>
</div>
}
}