修改功能

This commit is contained in:
zel
2025-02-08 16:40:55 +08:00
parent 4c8ecf55f7
commit c4bdebd92c
13 changed files with 90 additions and 79 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -1,8 +1,11 @@
namespace TightWiki.Models.DataModels
using System.ComponentModel.DataAnnotations;
namespace TightWiki.Models.DataModels
{
public class Emoji
{
public int Id { get; set; }
[Display(Name ="名称")]
public string Name { get; set; } = string.Empty;
public string Shortcut { get; set; } = string.Empty;
public int PaginationPageCount { get; set; }

View File

@@ -5,42 +5,42 @@ namespace TightWiki.Models.ViewModels.Admin
{
public partial class AccountProfileAccountViewModel
{
[Display(Name = "Theme")]
[Display(Name = "主题")]
public string? Theme { get; set; } = string.Empty;
public Guid UserId { get; set; }
[Display(Name = "Email Address")]
[Required(ErrorMessage = "Email address is required")]
[Display(Name = "Email")]
[Required(ErrorMessage = "邮箱地址为必填项")]
public string EmailAddress { get; set; } = string.Empty;
[Display(Name = "Account Name")]
[Required(ErrorMessage = "Account name is required")]
[Display(Name = "账号")]
[Required(ErrorMessage = "账号为必填项")]
public string AccountName { get; set; } = string.Empty;
public string? Navigation { get; set; } = string.Empty;
[Display(Name = "First Name")]
public string? FirstName { get; set; }
[Display(Name = "Last Name")]
[Display(Name = "")]
public string? LastName { get; set; } = string.Empty;
[Display(Name = "Time-Zone")]
[Required(ErrorMessage = "TimeZone is required")]
[Display(Name = "")]
public string? FirstName { get; set; }
[Display(Name = "时区")]
[Required(ErrorMessage = "时区为必填项")]
public string TimeZone { get; set; } = string.Empty;
[Display(Name = "Country")]
[Required(ErrorMessage = "Country is required")]
[Display(Name = "国家")]
[Required(ErrorMessage = "国家为必填项")]
public string Country { get; set; } = string.Empty;
[Display(Name = "Language")]
[Required(ErrorMessage = "Language is required")]
[Display(Name = "语言")]
[Required(ErrorMessage = "语言为必填项")]
public string Language { get; set; } = string.Empty;
[Display(Name = "Biography")]
[Display(Name = "个人简介")]
public string? Biography { get; set; } = string.Empty;
[Display(Name = "Email Confirmed?")]
[Display(Name = "邮箱确认?")]
public bool EmailConfirmed { get; set; }
public byte[]? Avatar { get; set; }

View File

@@ -1,10 +1,16 @@
namespace TightWiki.Models.ViewModels.Admin
using System.ComponentModel.DataAnnotations;
namespace TightWiki.Models.ViewModels.Admin
{
public class AddEmojiViewModel : ViewModelBase
{
public int Id { get; set; }
[Display(Name ="名称")]
public string Name { get; set; } = string.Empty;
public string? OriginalName { get; set; }
[Display(Name = "分类")]
public string Categories { get; set; } = string.Empty;
}
}

View File

@@ -1,4 +1,5 @@
using TightWiki.Models.DataModels;
using System.ComponentModel.DataAnnotations;
using TightWiki.Models.DataModels;
namespace TightWiki.Models.ViewModels.Admin
{
@@ -6,6 +7,7 @@ namespace TightWiki.Models.ViewModels.Admin
{
public Emoji Emoji { get; set; } = new();
public string OriginalName { get; set; } = string.Empty;
[Display(Name = "分类")]
public string Categories { get; set; } = string.Empty;
}
}

View File

@@ -6,11 +6,11 @@
}
<h3>
账号
用户
</h3>
<p>
设置您的账号<br /><br />
账号设置<br /><br />
</p>
@@ -34,7 +34,7 @@
@Html.HiddenFor(m => m.AccountProfile.Navigation)
<div class="form-group row mb-1">
<label for="Avatar" class="col-sm-2 col-form-label"><strong>Avatar</strong></label>
<label for="Avatar" class="col-sm-2 col-form-label"><strong>头像</strong></label>
<div class="col-sm-10">
@if (@Model.AccountProfile.Navigation != "")
{
@@ -51,7 +51,7 @@
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.EmailAddress)</div>
</div>
</div>
<div class="form-group row mb-1">
<div class="form-group row mb-1" style="display:none;">
<label for="EmailConfirmed" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.EmailConfirmed)</strong></label>
<div class="col-sm-10">
@Html.CheckBoxFor(m => m.AccountProfile.EmailConfirmed, new { @class = "input-control" })
@@ -66,14 +66,6 @@
</div>
</div>
<div class="form-group row mb-1">
<label for="FirstName" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.FirstName)</strong></label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.AccountProfile.FirstName, new { @class = "form-control" })
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.FirstName)</div>
</div>
</div>
<div class="form-group row mb-1">
<label for="LastName" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.LastName)</strong></label>
<div class="col-sm-10">
@@ -82,6 +74,14 @@
</div>
</div>
<div class="form-group row mb-1">
<label for="FirstName" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.FirstName)</strong></label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.AccountProfile.FirstName, new { @class = "form-control" })
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.FirstName)</div>
</div>
</div>
<div class="form-group row mb-1">
<label for="Role" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.Role)</strong></label>
<div class="col-sm-10">
@@ -134,7 +134,7 @@
<label for="Language" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.Language)</strong></label>
<div class="col-sm-10">
<select name="AccountProfile.Language" id="AccountProfile.Language" class="form-control">
<option value="" style="color:#ccc !important;">Select a language</option>
<option value="" style="color:#ccc !important;">选择一个语言</option>
@foreach (var item in Model.Languages)
{
<option value="@item.Value" selected=@(Model.AccountProfile.Language == item.Value ? "selected" : null)>
@@ -187,7 +187,7 @@
<div class="form-group row mb-1">
<div class="col-sm-10 offset-sm-2">
<button type="submit" class="btn btn btn-primary rounded-0">Save!</button>
<button type="submit" class="btn btn btn-primary rounded-0">保存!</button>
</div>
</div>
</form>
@@ -196,4 +196,4 @@
}
<br />
<form action="@GlobalConfiguration.BasePath/Admin/DeleteAccount/@Model.AccountProfile.Navigation"><button type="submit" class="btn btn-danger rounded-0">Delete Account</button></form>
<form action="@GlobalConfiguration.BasePath/Admin/DeleteAccount/@Model.AccountProfile.Navigation"><button type="submit" class="btn btn-danger rounded-0">删除账号</button></form>

View File

@@ -7,11 +7,11 @@
}
<h3>
Accounts
账号
</h3>
<p>
Global configuration for user accounts.<br /><br />
<br /><br />
</p>
@@ -24,7 +24,7 @@
<div class="alert alert-success">@Html.Raw(Model.SuccessMessage)</div>
}
<a class="btn btn-success btn-thin" href="@GlobalConfiguration.BasePath/Admin/AddAccount">Add new account</a>
<a class="btn btn-success btn-thin" href="@GlobalConfiguration.BasePath/Admin/AddAccount">新增</a>
<br />
<br />
@@ -35,7 +35,7 @@
<div class="flex-grow-1 me-2">
@Html.TextBoxFor(x => x.SearchString, new { @class = "form-control" })
</div>
<button type="submit" value="Search" class="btn btn-primary">Search</button>
<button type="submit" value="Search" class="btn btn-primary">搜索</button>
</div>
</div>
@@ -44,13 +44,13 @@
<table class="table fixedTable100 table-striped" border="0" cellspacing="0" cellpadding="0">
<thead>
<tr>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Account")">Account</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "LastName")">Last Name</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "FirstName")">First Name</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Country")">Country</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "TimeZone")">TimeZone</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "EmailAddress")">EmailAddress</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Created")">CreatedDate</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Account")">账号</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "LastName")"></a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "FirstName")"></a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Country")">国家</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "TimeZone")">时区</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "EmailAddress")">Email</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Created")">创建时间</a></strong></td>
</tr>
</thead>
@@ -74,14 +74,14 @@
{
<div class="d-flex small text-muted mb-0">
<strong>
Either there are no accounts configured or your search criteria returned no results.
暂无数据
</strong>
</div>
}
}
<br />
<a class="btn btn-success btn-thin" href="@GlobalConfiguration.BasePath/Admin/AddAccount">Add new account</a>
<a class="btn btn-success btn-thin" href="@GlobalConfiguration.BasePath/Admin/AddAccount">新增</a>
<script>
window.onload = function () {

View File

@@ -6,11 +6,11 @@
}
<h3>
新增账号
新增用户
</h3>
<p>
Create new user account.<br /><br />
<br /><br />
</p>
@if (!string.IsNullOrEmpty(Model.ErrorMessage))
@@ -31,7 +31,7 @@
@Html.HiddenFor(m => m.AccountProfile.Navigation)
<div class="form-group row mb-1">
<label for="Avatar" class="col-sm-2 col-form-label"><strong>Avatar</strong></label>
<label for="Avatar" class="col-sm-2 col-form-label"><strong>头像</strong></label>
<div class="col-sm-10">
<input type="file" id="Avatar" name="Avatar" class="form-control-file" onchange="fileCheck(this);" />
</div>
@@ -53,14 +53,6 @@
</div>
</div>
<div class="form-group row mb-1">
<label for="FirstName" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.FirstName)</strong></label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.AccountProfile.FirstName, new { @class = "form-control", placeholder = "not required" })
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.FirstName)</div>
</div>
</div>
<div class="form-group row mb-1">
<label for="LastName" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.LastName)</strong></label>
<div class="col-sm-10">
@@ -69,6 +61,14 @@
</div>
</div>
<div class="form-group row mb-1">
<label for="FirstName" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.FirstName)</strong></label>
<div class="col-sm-10">
@Html.TextBoxFor(m => m.AccountProfile.FirstName, new { @class = "form-control", placeholder = "not required" })
<div class="text-danger">@Html.ValidationMessageFor(m => m.AccountProfile.FirstName)</div>
</div>
</div>
<div class="form-group row mb-1">
<label for="Role" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.Role)</strong></label>
<div class="col-sm-10">
@@ -89,7 +89,7 @@
<label for="Country" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.AccountProfile.Country)</strong></label>
<div class="col-sm-10">
<select name="AccountProfile.Country" id="AccountProfile.Country" class="form-control">
<option value="" style="color:#ccc !important;">Select a country</option>
<option value="" style="color:#ccc !important;">选择一个国家</option>
@foreach (var item in Model.Countries)
{
<option value="@item.Value" selected=@(Model.AccountProfile.Country == item.Value ? "selected" : null)>

View File

@@ -21,12 +21,10 @@
</script>
<h3>
Add Emoji
新增 Emoji
</h3>
<p>
Configuration to add an emoji.<br /><br />
</p>
<p><br /><br /></p>
@if (!string.IsNullOrEmpty(Model.ErrorMessage))
{
@@ -45,7 +43,7 @@
<div class="container">
<form>
<div class="form-group row mb-1">
<label for="ImageData" class="col-sm-2 col-form-label"><strong>Image</strong></label>
<label for="ImageData" class="col-sm-2 col-form-label"><strong>图片</strong></label>
<div class="col-sm-10">
<input type="file" id="ImageData" name="ImageData" class="form-control-file" onchange="fileCheck(this);" accept="image/png, image/jpeg, image/gif" />
</div>
@@ -54,13 +52,13 @@
<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" })
@Html.TextBoxFor(m => m.Name, new { @class = "form-control", placeholder = "必填项" })
<div class="text-danger">@Html.ValidationMessageFor(m => m.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>
<label for="Categories" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.Categories)</strong> (以英文逗号分割)</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>
@@ -69,7 +67,7 @@
<div class="form-group row mb-1">
<div class="col-sm-10 offset-sm-2">
<button type="submit" class="btn btn-success rounded-0">Save!</button>
<button type="submit" class="btn btn-success rounded-0">保存!</button>
</div>
</div>
</form>

View File

@@ -6,8 +6,10 @@
}
<h3>Emoji</h3>
<p>
<br /><br />
</p>
<p>Configuration for an emoji.</p>
@if (!string.IsNullOrEmpty(Model.ErrorMessage))
{
@@ -26,7 +28,7 @@
<div class="container">
<div class="form-group row mb-1">
<label for="ImageData" class="col-sm-2 col-form-label"><strong>Image</strong></label>
<label for="ImageData" class="col-sm-2 col-form-label"><strong>图片</strong></label>
<div class="col-sm-10">
@if (@Model.Emoji.Name != "")
{
@@ -46,7 +48,7 @@
</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>
<label for="Categories" class="col-sm-2 col-form-label"><strong>@Html.LabelFor(m => m.Categories)</strong> (以英文逗号分割)</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>

View File

@@ -11,7 +11,7 @@
</h3>
<p>
Global configuration for Emojis.<br /><br />
<br /><br />
</p>
@if (!string.IsNullOrEmpty(Model.ErrorMessage))
@@ -23,7 +23,7 @@
<div class="alert alert-success">@Html.Raw(Model.SuccessMessage)</div>
}
<a class="btn btn-success btn-thin" href="@GlobalConfiguration.BasePath/Admin/AddEmoji">Add new emoji</a>
<a class="btn btn-success btn-thin" href="@GlobalConfiguration.BasePath/Admin/AddEmoji">新增</a>
<br />
<br />
@@ -34,7 +34,7 @@
<div class="flex-grow-1 me-2">
@Html.TextBoxFor(x => x.SearchString, new { @class = "form-control" })
</div>
<button type="submit" class="btn btn-primary">Search</button>
<button type="submit" class="btn btn-primary">搜索</button>
</div>
</div>
<br />
@@ -44,9 +44,9 @@
<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, "Shortcut")">Shortcut</a></strong></td>
<td><strong>Image</strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Name")">名称</a></strong></td>
<td><strong><a href="?@QueryStringConverter.OrderHelper(sessionState, "Shortcut")">快捷方式</a></strong></td>
<td><strong>图片</strong></td>
</tr>
</thead>
@@ -66,14 +66,14 @@
{
<div class="d-flex small text-muted mb-0">
<strong>
Either there are no emojis configured or your search criteria returned no results.
查询不到emoji
</strong>
</div>
}
}
<br />
<a class="btn btn-success btn-thin" href="@GlobalConfiguration.BasePath/Admin/AddEmoji">Add new emoji</a>
<a class="btn btn-success btn-thin" href="@GlobalConfiguration.BasePath/Admin/AddEmoji">新增</a>
<script>
window.onload = function () {