Отредактировал layout

This commit is contained in:
Никита Потапов 2024-04-30 15:34:48 +04:00
parent bee93877d1
commit 4197f4e557
10 changed files with 51 additions and 30 deletions

View File

@ -0,0 +1,19 @@
namespace PolyclinicWebView
{
public static class SiteMenuItems
{
public static (string Url, string Title) Index = ("", "Главная");
public static (string Url, string Title) Courses = ("Courses", "Курсы");
public static (string Url, string Title) Diagnoses = ("Diagnoses", "Болезни");
public static (string Url, string Title) Medicaments = ("Medicaments", "Лекарства");
public static (string Url, string Title) Procedures = ("Procedures", "Процедуры");
public static (string Url, string Title) Recipes = ("Recipes", "Рецепты");
public static (string Url, string Title) Symptomes = ("Symptomes", "Симптомы");
public static (string Url, string Title) Users = ("Users", "Пользователи");
public static List<(string Url, string Title)> MenuItemsOrder = new List<(string Url, string Title)>
{
Index, Courses, Diagnoses, Medicaments, Procedures, Recipes, Symptomes, Users
};
}
}

View File

@ -2,6 +2,7 @@
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@ *@
@{ @{
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Courses;
} }
<div> <div>
<table class="table"> <table class="table">

View File

@ -2,4 +2,5 @@
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@ *@
@{ @{
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Diagnoses;
} }

View File

@ -1,5 +1,5 @@
@{ @{
ViewData["Title"] = "Home Page"; ViewBag.SelectedSiteMenuItem = SiteMenuItems.Index;
} }
<div class="text-center"> <div class="text-center">

View File

@ -1,7 +1,7 @@
@using PolyclinicContracts.ViewModels @using PolyclinicContracts.ViewModels
@model List<MedicamentViewModel> @model List<MedicamentViewModel>
@{ @{
ViewData["Title"] = "Medicaments"; ViewBag.SelectedSiteMenuItem = SiteMenuItems.Medicaments;
} }
<div class="text-center"> <div class="text-center">
<h1 class="display-4">Препараты</h1> <h1 class="display-4">Препараты</h1>

View File

@ -2,4 +2,5 @@
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@ *@
@{ @{
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Procedures;
} }

View File

@ -2,4 +2,5 @@
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@ *@
@{ @{
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Recipes;
} }

View File

@ -2,4 +2,5 @@
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@ *@
@{ @{
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Symptomes;
} }

View File

@ -2,4 +2,5 @@
For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860 For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@ *@
@{ @{
ViewBag.SelectedSiteMenuItem = SiteMenuItems.Users;
} }

View File

@ -3,7 +3,16 @@
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - PolyclinicWebView</title> <title>
@if (ViewData.ContainsKey("SelectedSiteMenuItem"))
{
@ViewBag.SelectedSiteMenuItem.Item2
}
else if (ViewData.ContainsKey("Title"))
{
@ViewData["Title"]
}
</title>
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" /> <link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="~/css/site.css" asp-append-version="true" /> <link rel="stylesheet" href="~/css/site.css" asp-append-version="true" />
<link rel="stylesheet" href="~/PolyclinicWebView.styles.css" asp-append-version="true" /> <link rel="stylesheet" href="~/PolyclinicWebView.styles.css" asp-append-version="true" />
@ -18,33 +27,20 @@
</button> </button>
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between"> <div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
<ul class="navbar-nav flex-grow-1"> <ul class="navbar-nav flex-grow-1">
<li class="nav-item"> @foreach (var menuItem in SiteMenuItems.MenuItemsOrder)
<a class="nav-link text-dark fw-bold" asp-area="" asp-controller="Home" asp-action="Index">Главная</a> {
</li> <li class="menu-item">
<li class="nav-item"> @Html.RouteLink(menuItem.Title, new
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Register">Регистрация</a> {
</li> controller = "Home",
<li class="nav-item"> action = menuItem.Url
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Courses">Курсы приема препаратов</a> }, new
</li> {
<li class="nav-item"> @class = "nav-link text-dark" + (menuItem.Equals(ViewBag.SelectedSiteMenuItem) ? " fw-bold" : "")
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Diagnoses">Диагнозы</a> }
</li> )
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Medicaments">Препараты</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Procedures">Процедуры</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Recipes">Рецепты</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Symptomes">Симптомы</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Users">Пользователи</a>
</li> </li>
}
</ul> </ul>
</div> </div>
</div> </div>