Skip to content

Commit

Permalink
Merge pull request #262 from gaepdit/261-adjustments-for-bootstrap-5x…
Browse files Browse the repository at this point in the history
…-and-code-cleanup

Code adjustment and Bootstrap changes
  • Loading branch information
tom-karasch authored Oct 30, 2023
2 parents 83624c4 + c2d49e4 commit 0a428e6
Show file tree
Hide file tree
Showing 6 changed files with 86 additions and 86 deletions.
2 changes: 1 addition & 1 deletion FMS.Domain/Data/Counties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace FMS.Domain.Data
{
public static partial class Data
{
public static List<County> Counties => new List<County>
public static List<County> Counties => new()
{
new County { Id = 131, Name = "Appling" },
new County { Id = 122, Name = "Atkinson" },
Expand Down
2 changes: 1 addition & 1 deletion FMS.Domain/Entities/File.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public File(int countyNum, int sequence) =>
// Static methods
public static string CountyString(int countyNum)
{
if (Counties.All(e => e.Id != countyNum))
if (Counties.TrueForAll(e => e.Id != countyNum))
{
throw new ArgumentException($"County ID {countyNum} does not exist.", nameof(countyNum));
}
Expand Down
4 changes: 2 additions & 2 deletions FMS/Pages/Facilities/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public class IndexModel : PageModel
public bool ShowResults { get; private set; }

// Select Lists
public SelectList Counties => new SelectList(Data.Counties, "Id", "Name");
public SelectList States => new SelectList(Data.States);
public SelectList Counties => new(Data.Counties, "Id", "Name");
public SelectList States => new(Data.States);
public SelectList FacilityStatuses { get; private set; }
public SelectList FacilityTypes { get; private set; }
public SelectList BudgetCodes { get; private set; }
Expand Down
60 changes: 30 additions & 30 deletions FMS/Pages/Files/Details.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}
<h1>
@ViewData["Title"]
@if (!Model.FileDetail.Active)
@if (!Model.FileDetail.Active)
{
<span class="text-muted">(Deleted)</span>
}
Expand All @@ -17,13 +17,13 @@
<div class="my-3">
<dl class="row">
<dt class="col-sm-2">Cabinets</dt>
@if (Model.FileDetail.Cabinets != null && Model.FileDetail.Cabinets.Count > 0)
@if (Model.FileDetail.Cabinets != null && Model.FileDetail.Cabinets.Count > 0)
{
<dd class="col-sm-10">
@Model.FileDetail.Cabinets.ConcatNonEmpty(", ")
</dd>
}
else
}
else
{
<dd class="col-sm-10">
No cabinets found for this File.
Expand All @@ -35,38 +35,38 @@
<div class="my-3">
<h2>Facilities</h2>

@if (Model.FileDetail.Facilities != null && Model.FileDetail.Facilities.Count > 0)
@if (Model.FileDetail.Facilities != null && Model.FileDetail.Facilities.Count > 0)
{
<table class="table table-borderless" aria-label="List of facilities in this file">
<thead class="thead-light">
<tr>
<th scope="col">Facility</th>
<th scope="col">Name</th>
<th scope="col">Address</th>
</tr>
</thead>
<tbody>
@foreach (var item in Model.FileDetail.Facilities)
{
<thead class="table-light">
<tr>
<td>
<a asp-page="/Facilities/Details" asp-route-id="@item.Id" class="btn btn-outline-info btn-sm">
@Html.DisplayFor(m => item.FacilityNumber)
</a>
</td>
<td>
@Html.DisplayFor(m => item.Name)
</td>
<td>
@Html.DisplayFor(m => item.Address)<br />
@Html.DisplayFor(m => item.City), @Html.DisplayFor(m => item.State) @Html.DisplayFor(m => item.PostalCode)
</td>
<th scope="col">Facility</th>
<th scope="col">Name</th>
<th scope="col">Address</th>
</tr>
}
</thead>
<tbody>
@foreach (var item in Model.FileDetail.Facilities)
{
<tr>
<td>
<a asp-page="/Facilities/Details" asp-route-id="@item.Id" class="btn btn-outline-info btn-sm">
@Html.DisplayFor(m => item.FacilityNumber)
</a>
</td>
<td>
@Html.DisplayFor(m => item.Name)
</td>
<td>
@Html.DisplayFor(m => item.Address)<br />
@Html.DisplayFor(m => item.City), @Html.DisplayFor(m => item.State) @Html.DisplayFor(m => item.PostalCode)
</td>
</tr>
}
</tbody>
</table>
}
else
}
else
{
<p class="lead text-info">No facilities found for this File.</p>
}
Expand Down
2 changes: 1 addition & 1 deletion FMS/Pages/Maintenance/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<p class="lead">Select a drop-down list to edit.</p>

<ul class="nav flex-column">
<ul>
<li>
<a class="nav-link" asp-page="BudgetCode/Index">@MaintenanceOptions.BudgetCode</a>
</li>
Expand Down
102 changes: 51 additions & 51 deletions FMS/Pages/Shared/_MenuPartial.cshtml
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
@using FMS.Domain.Entities.Users

<div class="container-fluid">
<nav class="navbar navbar-expand-sm bg-brand">
<div class="container">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerMain"
aria-controls="navbarTogglerMain" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="align-middle">Menu</span>
</button>
<div class="collapse navbar-collapse d-sm-inline-flex" id="navbarTogglerMain">
<ul class="navbar-nav flex-grow-1 mr-auto">
<li class="nav-item">
<a class="nav-link text-white" asp-page="/Facilities/Index">Facility Search</a>
</li>

<nav class="navbar navbar-expand-sm bg-brand">
<div class="container">
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarTogglerMain"
aria-controls="navbarTogglerMain" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="align-middle text-white">Menu</span>
</button>
<div class="collapse navbar-collapse d-sm-inline-flex" id="navbarTogglerMain">
<ul class="navbar-nav flex-grow-1 mr-auto">
<li class="nav-item">
<a class="nav-link text-white" asp-page="/Facilities/Index">Facility Search</a>
</li>
<li class="nav-item">
<a class="nav-link text-white" asp-page="/Facilities/Map">Location Search</a>
</li>
@if (User.IsInRole(UserRoles.FileCreator) || User.IsInRole(UserRoles.FileEditor))
{
<li class="nav-item">
<a class="nav-link text-white" asp-page="/Facilities/Map">Location Search</a>
<a class="nav-link text-white" asp-page="/Facilities/Add">Add Facility</a>
</li>
@if (User.IsInRole(UserRoles.FileCreator) || User.IsInRole(UserRoles.FileEditor))
{
<li class="nav-item">
<a class="nav-link text-white" asp-page="/Facilities/Add">Add Facility</a>
}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle text-white" href="#" id="MoreDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
More
</a>
<ul class="dropdown-menu" aria-labelledby="MoreDropdown">
<li><a class="dropdown-item" asp-page="/Files/Index">Files</a></li>
<li><a class="dropdown-item" asp-page="/Cabinets/Index">Cabinets</a></li>
<li><a class="dropdown-item" asp-page="/Users/Index">FMS Users</a></li>
@if (User.IsInRole(UserRoles.SiteMaintenance))
{
<li><a class="dropdown-item" asp-page="/Maintenance/Index">Site Maintenance</a></li>
}
</ul>
</li>
</ul>
<ul class="navbar-nav d-flex">
<li class="nav-item dropdown text-dark">
<button class="nav-link dropdown-toggle text-white" id="accountDropdownMenuLink" role="button" type="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="View account menu">
Account
</button>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="accountDropdownMenuLink">
<li><a class="dropdown-item" asp-page="/Account/Index">Your profile</a></li>
<li>
<form class="form-inline dropdown-item p-0" asp-page="/Account/Logout" method="post">
<button type="submit" class="dropdown-item bg-danger text-light px-4 py-2">Sign out</button>
</form>
</li>
}
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle text-white" href="#" id="MoreDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
More
</a>
<ul class="dropdown-menu" aria-labelledby="MoreDropdown">
<li><a class="dropdown-item" asp-page="/Files/Index">Files</a></li>
<li><a class="dropdown-item" asp-page="/Cabinets/Index">Cabinets</a></li>
<li><a class="dropdown-item" asp-page="/Users/Index">FMS Users</a></li>
@if (User.IsInRole(UserRoles.SiteMaintenance))
{
<li><a class="dropdown-item" asp-page="/Maintenance/Index">Site Maintenance</a></li>
}
</ul>
</li>
</ul>
<ul class="navbar-nav d-flex">
<li class="nav-item dropdown text-dark">
<button class="nav-link dropdown-toggle text-white" id="accountDropdownMenuLink" role="button" type="button" data-bs-toggle="dropdown" aria-haspopup="true" aria-expanded="false" title="View account menu">
Account
</button>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="accountDropdownMenuLink">
<li><a class="dropdown-item" asp-page="/Account/Index">Your profile</a></li>
<li>
<form class="form-inline dropdown-item p-0" asp-page="/Account/Logout" method="post">
<button type="submit" class="dropdown-item bg-danger text-light px-4 py-2">Sign out</button>
</form>
</li>
</ul>
</li>
</ul>
</div>
</ul>
</li>
</ul>
</div>
</nav>
</div>
</div>
</nav>

0 comments on commit 0a428e6

Please sign in to comment.