53 lines
2.0 KiB
Plaintext
53 lines
2.0 KiB
Plaintext
@page
|
|
@model StatiKosev.Pages.InboxModel
|
|
@inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Antiforgery
|
|
@{
|
|
ViewData["Title"] = StringValues["Messages"];
|
|
}
|
|
@section Head {
|
|
<link rel="stylesheet" href="~/styles/account.css" asp-append-version="true"/>
|
|
<link rel="stylesheet" href="~/styles/inbox.css" asp-append-version="true"/>
|
|
}
|
|
|
|
@if (!Model.IsAdmin)
|
|
{
|
|
@* no account: the admin password is checked by PrivateMessageController.Login *@
|
|
<form method="post" asp-controller="PrivateMessage" asp-action="Login" class="auth-card" data-once>
|
|
<h1>@StringValues["Messages"]</h1>
|
|
<label>@StringValues["AdminPassword"]
|
|
<input type="password" name="password" required autocomplete="current-password" autofocus/>
|
|
</label>
|
|
<button type="submit">@StringValues["AdminLogin"]</button>
|
|
</form>
|
|
}
|
|
else
|
|
{
|
|
@* messages are loaded as JSON from PrivateMessageController by inbox.js *@
|
|
<section class="inbox"
|
|
data-list="/messages/list"
|
|
data-base="/messages"
|
|
data-token="@Antiforgery.GetAndStoreTokens(HttpContext).RequestToken"
|
|
data-anonymous="@StringValues["Anonymous"]"
|
|
data-mark-read="@StringValues["MarkRead"]"
|
|
data-read="@StringValues["Read"]"
|
|
data-empty="@StringValues["NoMessages"]"
|
|
data-failed="@StringValues["LoadFailed"]">
|
|
<header class="inbox-header">
|
|
<h1>@StringValues["Messages"]</h1>
|
|
<label><input type="checkbox" class="inbox-unread-only"/> @StringValues["UnreadOnly"]</label>
|
|
<form method="post" asp-controller="PrivateMessage" asp-action="Logout" class="inbox-logout">
|
|
<button type="submit">@StringValues["AdminLogout"]</button>
|
|
</form>
|
|
</header>
|
|
<p class="inbox-status" role="status" aria-live="polite">@StringValues["Loading"]</p>
|
|
<ol class="inbox-list"></ol>
|
|
</section>
|
|
}
|
|
|
|
@section Scripts {
|
|
@if (Model.IsAdmin)
|
|
{
|
|
<script src="~/scripts/inbox.js" asp-append-version="true"></script>
|
|
}
|
|
}
|