2026-10-27 10:15:05 +02:00
|
|
|
@{
|
|
|
|
|
var path = Context.Request.Path.Value ?? "/";
|
2026-10-28 11:10:46 +02:00
|
|
|
var lang = System.Globalization.CultureInfo.CurrentUICulture.TwoLetterISOLanguageName;
|
2026-10-28 13:23:35 +02:00
|
|
|
var loggedIn = User.Identity?.IsAuthenticated == true;
|
2026-10-27 10:15:05 +02:00
|
|
|
string Active(string p) => path.Equals(p, StringComparison.OrdinalIgnoreCase) ? "active" : "";
|
2026-10-28 11:10:46 +02:00
|
|
|
string? Current(string p) => Active(p) == "" ? null : "page";
|
2026-10-28 13:23:35 +02:00
|
|
|
|
|
|
|
|
//one-line notice: message status from the controller (TempData), rate limit (?wait=1), login/register errors (?auth=)
|
|
|
|
|
var status = TempData["Status"] as string;
|
|
|
|
|
var statusType = TempData["StatusType"] as string ?? "info";
|
|
|
|
|
if (Context.Request.Query["wait"] == "1")
|
|
|
|
|
(status, statusType) = (StringValues["TooManyMessages"].Value, "error");
|
|
|
|
|
else if (Context.Request.Query["auth"] == "login-failed")
|
|
|
|
|
(status, statusType) = (StringValues["LoginFailed"].Value, "error");
|
|
|
|
|
else if (Context.Request.Query["auth"] == "register-failed")
|
|
|
|
|
(status, statusType) = (StringValues["RegisterFailed"].Value, "error");
|
2026-10-27 10:15:05 +02:00
|
|
|
}
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
|
2026-10-28 11:10:46 +02:00
|
|
|
<html lang="@lang">
|
2026-10-27 10:15:05 +02:00
|
|
|
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8"/>
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
2026-10-28 13:23:35 +02:00
|
|
|
<title>@(ViewData["Title"] ?? StringValues["Title"])</title>
|
2026-10-28 11:10:46 +02:00
|
|
|
<link rel="stylesheet" href="~/styles/site.css" asp-append-version="true"/>
|
|
|
|
|
<link rel="stylesheet" href="~/styles/message-form.css" asp-append-version="true"/>
|
2026-10-28 13:23:35 +02:00
|
|
|
@await RenderSectionAsync("Head", required: false)
|
2026-10-27 10:15:05 +02:00
|
|
|
</head>
|
|
|
|
|
<body>
|
2026-10-28 11:10:46 +02:00
|
|
|
<header class="site-header">
|
|
|
|
|
<nav class="main-nav" aria-label="@StringValues["Navigation"]">
|
|
|
|
|
<a asp-page="/Index" class="@Active("/")" aria-current="@Current("/")">@StringValues["Home"]</a>
|
|
|
|
|
<a asp-page="/Gallery" class="@Active("/Gallery")" aria-current="@Current("/Gallery")">@StringValues["Gallery"]</a>
|
2026-10-28 13:23:35 +02:00
|
|
|
@if (User.IsInRole("Admin"))
|
|
|
|
|
{
|
|
|
|
|
<a asp-page="/Inbox" class="@Active("/Inbox")" aria-current="@Current("/Inbox")">@StringValues["Messages"]</a>
|
|
|
|
|
}
|
2026-10-28 11:10:46 +02:00
|
|
|
</nav>
|
2026-10-28 13:23:35 +02:00
|
|
|
<div class="header-end">
|
|
|
|
|
@if (loggedIn)
|
|
|
|
|
{
|
|
|
|
|
<form method="post" action="/account/logout" asp-antiforgery="true" class="logout-form">
|
|
|
|
|
<span class="user-name">@User.Identity!.Name</span>
|
|
|
|
|
<button type="submit">@StringValues["Logout"]</button>
|
|
|
|
|
</form>
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
<a asp-page="/Login" asp-route-returnUrl="@(Active("/Login") == "" ? path : null)" class="@Active("/Login")" aria-current="@Current("/Login")">@StringValues["Login"]</a>
|
|
|
|
|
}
|
|
|
|
|
<div class="lang-switch">
|
|
|
|
|
<a href="/set-language?culture=bg&returnUrl=@Context.Request.Path" class="@(lang == "bg" ? "active" : "")" lang="bg">Български</a>
|
|
|
|
|
<a href="/set-language?culture=en&returnUrl=@Context.Request.Path" class="@(lang == "en" ? "active" : "")" lang="en">English</a>
|
|
|
|
|
</div>
|
2026-10-28 11:10:46 +02:00
|
|
|
</div>
|
|
|
|
|
</header>
|
2026-10-27 10:15:05 +02:00
|
|
|
|
2026-10-28 13:23:35 +02:00
|
|
|
@if (status is not null)
|
|
|
|
|
{
|
|
|
|
|
<p class="flash flash-@statusType" role="status">@status</p>
|
|
|
|
|
}
|
|
|
|
|
|
2026-10-27 10:15:05 +02:00
|
|
|
<main>@RenderBody()</main>
|
2026-10-28 13:23:35 +02:00
|
|
|
|
|
|
|
|
<script src="~/scripts/site.js" asp-append-version="true"></script>
|
|
|
|
|
@await RenderSectionAsync("Scripts", required: false)
|
2026-10-27 10:15:05 +02:00
|
|
|
</body>
|
2026-10-28 11:10:46 +02:00
|
|
|
</html>
|