Files
ZelWiki/TightWiki/Views/Admin/Emoji.cshtml
2025-02-07 16:45:52 +08:00

69 lines
2.7 KiB
Plaintext

@using TightWiki.Models
@model TightWiki.Models.ViewModels.Admin.EmojiViewModel
@{
Layout = "/Views/Shared/_Layout.cshtml";
var sessionState = ViewData["SessionState"] as TightWiki.SessionState ?? throw new Exception("Wiki State Context cannot be null.");
}
<h3>Emoji</h3>
<p>Configuration for an emoji.</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, new { navigation = Model.Emoji.Name }, FormMethod.Post, true, new { action = $"{GlobalConfiguration.BasePath}{Context.Request.Path}", enctype = "multipart/form-data" }))
{
@Html.AntiForgeryToken()
@Html.HiddenFor(m => m.OriginalName)
@Html.HiddenFor(m => m.Emoji.Id)
<div class="container">
<div class="form-group row mb-1">
<label for="ImageData" class="col-sm-2 col-form-label"><strong>Image</strong></label>
<div class="col-sm-10">
@if (@Model.Emoji.Name != "")
{
<img src="@GlobalConfiguration.BasePath/File/Emoji/@Model.Emoji.Name" class="mb-3" />
<br />
}
<input type="file" id="ImageData" name="ImageData" class="form-control-file" onchange="fileCheck(this);" accept="image/png, image/jpeg, image/gif" />
</div>
</div>
<div class="form-group row mb-1">
<label for="Name" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.Emoji.Name)</strong></label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.Emoji.Name, new { @class = "form-control" })
<div class="text-danger">@Html.ValidationMessageFor(m => m.Emoji.Name)</div>
</div>
</div>
<div class="form-group row mb-1">
<label for="Categories" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.Categories)</strong> (comma separated)</label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.Categories, new { @class = "form-control" })
<div class="text-danger">@Html.ValidationMessageFor(m => m.Categories)</div>
</div>
</div>
<div class="form-group row mb-1">
<div class="col-sm-10 offset-sm-2">
<button type="submit" class="btn btn-success rounded-0">保存!</button>
</div>
</div>
</div>
}
<br />
<form action="@GlobalConfiguration.BasePath/Admin/DeleteEmoji/@Model.Emoji.Name">
<button type="submit" class="btn btn-danger rounded-0">删除Emoji</button>
</form>