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

61 lines
2.4 KiB
Plaintext

@using TightWiki.Models
@model TightWiki.Models.ViewModels.Admin.MenuItemViewModel
@{
Layout = "/Views/Shared/_Layout.cshtml";
var sessionState = ViewData["SessionState"] as TightWiki.SessionState ?? throw new Exception("Wiki State Context cannot be null.");
}
<h3>Site Menu Item</h3>
<p>Global configuration for the site menu item.</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.Post, new { action = $"{GlobalConfiguration.BasePath}{Context.Request.Path}" }))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(m => m.Id)
<div class="container">
<div class="form-group row mb-1">
<label for="Name" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.Name)</strong></label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.Name, new { @class = "form-control", placeholder = "required" })
<div class="text-danger">@Html.ValidationMessageFor(m => m.Name)</div>
</div>
</div>
<div class="form-group row mb-1">
<label for="Link" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.Link)</strong></label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.Link, new { @class = "form-control", placeholder = "required" })
<div class="text-danger">@Html.ValidationMessageFor(m => m.Link)</div>
</div>
</div>
<div class="form-group row mb-1">
<label for="Ordinal" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.Ordinal)</strong></label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.Ordinal, new { @class = "form-control", placeholder = "required" })
<div class="text-danger">@Html.ValidationMessageFor(m => m.Ordinal)</div>
</div>
</div>
<div class="form-group row mb-1">
<div class="col-sm-10 offset-sm-2">
<button type="submit" class="btn btn-primary rounded-0">Save!</button>
</div>
</div>
</div>
}
<br />
<form action="@GlobalConfiguration.BasePath/Admin/DeleteMenuItem/@Model.Id">
<button type="submit" class="btn btn-danger rounded-0">Delete Menu Item</button>
</form>