-
Notifications
You must be signed in to change notification settings - Fork 0
/
_Layout.cshtml
100 lines (92 loc) · 5 KB
/
_Layout.cshtml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
@*@model SearchAnimalViewModel;*@
@inject SignInManager<IdentityUser> signInManager;
@{
var searchModel = new SearchAnimalViewModel();
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>@ViewBag.Title</title>
<link href="~/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
<link href="~/css/StyleSheet.css" rel="stylesheet" />
<script src="~/lib/jquery/jquery.min.js"></script>
<script src="~/lib/jquery-validate/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>
<script src="~/lib/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="~/js/theme-mode.js"></script>
</head>
<body>
<nav class="navbar navbar-expand-lg bg-dark opacity-75">
<div class="container-fluid">
<a class="navbar-brand" asp-controller="Home" asp-action="Index">
<img class="logo" src="~/images/pet-shop-svgrepo-com.svg" alt="petShop" class="d-inline-block align-text-top" />
<b>Arad</b>
</a>
<button class="navbar-toggler bg-white bg-opacity-50" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link @((ViewBag.Title == "Home") ? "fw-bold" : "")" asp-controller="Home" asp-action="Index">Home</a>
</li>
<li class="nav-item">
<a class="nav-link @((ViewBag.Title is string t && t.Length > 7 && t.Substring(0, 7) == "Catalog") ? "fw-bold" : "")" asp-controller="Home" asp-action="Categories">Catalog</a>
</li>
@if (signInManager.IsSignedIn(User) && User.IsInRole("Admin"))
{
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Admin
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item text-dark" asp-controller="Home" asp-action="AddAnimal">Add Animal</a></li>
<li><a class="dropdown-item text-dark" asp-controller="Home" asp-action="ManageCategories">Manage Categories</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item text-dark" asp-controller="Account" asp-action="ManageUsers">Manage Users</a></li>
</ul>
</li>
}
@if (signInManager.IsSignedIn(User))
{
<li>
<form class="p-2" method="post" asp-controller="Account" asp-action="Logout">
<button type="submit" class="nav-link btn btn-link py-0">
Logout @User.Identity!.Name
</button>
</form>
</li>
}
else
{
<li class="nav-item">
<a class="nav-link" asp-controller="Account" asp-action="Login">Login</a>
</li>
<li class="nav-item">
<a class="nav-link" asp-controller="Account" asp-action="Register">Register</a>
</li>
}
<li class="nav-item" id="modeLi">
<div id="toggle">
<i class="button bg-dark bg-opacity-25">
<a>Light<br /><h6>Mode</h6></a>
<span>Dark<br /><h6>Mode</h6></span>
</i>
</div>
</li>
</ul>
@*https://stackoverflow.com/a/4526286/19827098*@
<form enctype="multipart/form-data" method="post" class="d-flex" asp-controller="Home" asp-action="Search">
@*asp-validation-for="Content"*@ <span asp-validation-for="@searchModel.Content" class="text-danger"></span>
@*asp-for="Content"*@ <input name="text" asp-for="@searchModel.Content" class=" form-control me-2" type="search" placeholder="Search" aria-label="Search">
<button class="btn btn-outline-success" type="submit">Search</button>
</form>
</div>
</div>
</nav>
<div class="container">
@RenderBody()
</div>
</body>
</html>