web: založení projektu Helpdesk.Web a layout aplikace
ASP.NET Core MVC (.NET 10) s Bootstrapem 5, layout s menu podle role, chybové stránky, bezpečnostní hlavičky (CSP, Referrer-Policy) a česká kultura. Refs #19, #20
This commit is contained in:
1 parent
b402d9f92c
commit
abd075287c
25 files changed
+523
No files matched your search
@@ -0,0 +1,15 @@
|
||||
@* Krátká zpráva po přesměrování (např. „Profil uložen“). Nastavuje se přes TempData.Success / TempData.Error. *@
|
||||
@if (TempData[Flash.Success] is string success)
|
||||
{
|
||||
<div class="alert alert-success alert-dismissible fade show" role="status">
|
||||
@success
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Zavřít"></button>
|
||||
</div>
|
||||
}
|
||||
@if (TempData[Flash.Error] is string error)
|
||||
{
|
||||
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
||||
@error
|
||||
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Zavřít"></button>
|
||||
</div>
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="cs">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>@(ViewData["Title"] is string title ? $"{title} · NTBug" : "NTBug")</title>
|
||||
<link rel="icon" href="~/favicon.svg" type="image/svg+xml" />
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
|
||||
</head>
|
||||
<body>
|
||||
<a class="visually-hidden-focusable skip-link" href="#main">Přeskočit na obsah</a>
|
||||
|
||||
<header class="app-header border-bottom">
|
||||
<nav class="navbar navbar-expand-lg container-xl" aria-label="Hlavní menu">
|
||||
<a class="navbar-brand app-brand" asp-controller="Home" asp-action="Index">
|
||||
<span class="app-brand-mark" aria-hidden="true">NT</span>
|
||||
<span>NTBug <span class="app-brand-sub">helpdesk</span></span>
|
||||
</a>
|
||||
|
||||
@if (User.Identity?.IsAuthenticated == true)
|
||||
{
|
||||
var controller = ViewContext.RouteData.Values["controller"] as string;
|
||||
var action = ViewContext.RouteData.Values["action"] as string;
|
||||
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainNav"
|
||||
aria-controls="mainNav" aria-expanded="false" aria-label="Zobrazit menu">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="mainNav">
|
||||
<ul class="navbar-nav me-auto">
|
||||
@foreach (var item in Navigation.For(User))
|
||||
{
|
||||
var active = item.Controller == controller && item.Action == action;
|
||||
<li class="nav-item">
|
||||
<a class="nav-link @(active ? "active" : "")" aria-current="@(active ? "page" : null)"
|
||||
asp-controller="@item.Controller" asp-action="@item.Action">@item.Text</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
@await Html.PartialAsync("_UserMenu")
|
||||
</div>
|
||||
}
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<main id="main" class="container-xl app-main">
|
||||
@await Html.PartialAsync("_Alerts")
|
||||
@RenderBody()
|
||||
</main>
|
||||
|
||||
<footer class="app-footer container-xl">
|
||||
Univerzitní helpdesk a portál návrhů na zlepšení · NNPRO
|
||||
</footer>
|
||||
|
||||
<script src="~/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,12 @@
|
||||
@{
|
||||
var role = User.FindFirst(ClaimTypes.Role)?.Value;
|
||||
}
|
||||
<div class="dropdown">
|
||||
<button class="btn btn-link app-user-toggle dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
||||
<span class="fw-semibold">@User.Identity?.Name</span>
|
||||
<span class="badge app-role-badge ms-1">@UserRoles.DisplayName(role)</span>
|
||||
</button>
|
||||
<ul class="dropdown-menu dropdown-menu-end">
|
||||
<li><span class="dropdown-item-text small text-body-secondary">@User.FindFirst(ClaimTypes.Email)?.Value</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
Reference in new issue
Block a user