Skip to content

Commit

Permalink
Merge pull request #111 from fluentcms/110-put-all-ui-pages-inside-ad…
Browse files Browse the repository at this point in the history
…min-route

put all admin pages insode /admin route
  • Loading branch information
pournasserian authored Nov 2, 2023
2 parents c99f3c7 + 86ef36c commit cab3d12
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 22 deletions.
10 changes: 5 additions & 5 deletions src/FluentCMS.Web.UI/Layout/Sidebar.razor
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<ul class="nav flex-column">
<li class="nav-item">
<NavLink class="nav-link d-flex align-items-center gap-2" href="" Match="NavLinkMatch.All">
<NavLink class="nav-link d-flex align-items-center gap-2" href="/admin" Match="NavLinkMatch.All">
Dashboard
</NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link d-flex align-items-center gap-2" href="counter">
<NavLink class="nav-link d-flex align-items-center gap-2" href="/admin/counter">
Counter
</NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link d-flex align-items-center gap-2" href="sites">
<NavLink class="nav-link d-flex align-items-center gap-2" href="/admin/sites">
Manage Sites
</NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link d-flex align-items-center gap-2" href="users">
<NavLink class="nav-link d-flex align-items-center gap-2" href="/admin/users">
Manage Users
</NavLink>
</li>
<li class="nav-item">
<NavLink class="nav-link d-flex align-items-center gap-2" href="roles">
<NavLink class="nav-link d-flex align-items-center gap-2" href="/admin/roles">
Manage Roles
</NavLink>
</li>
Expand Down
2 changes: 1 addition & 1 deletion src/FluentCMS.Web.UI/Pages/Counter.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@page "/counter"
@page "/admin/counter"

<PageTitle>Counter</PageTitle>

Expand Down
2 changes: 1 addition & 1 deletion src/FluentCMS.Web.UI/Pages/Home.razor
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@page "/"
@page "/admin"

<PageTitle>Home</PageTitle>
<a href="api/WeatherForecast/GetAll" target="_blank">Call Weather Api</a>
Expand Down
5 changes: 3 additions & 2 deletions src/FluentCMS.Web.UI/Pages/Sites/SiteEdit.razor
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
@page "/sites/edit/{Id:guid}"
@page "/sites/create"
@page "/admin/sites/edit/{Id:guid}"
@page "/admin/sites/create"
@inject HttpClient _httpClient
@inject NavigationManager _navigationManager

<h3>SiteEdit</h3>
<EditForm Model="Site" OnValidSubmit="ValidSubmit">
<div class="mb-3">
Expand Down
6 changes: 3 additions & 3 deletions src/FluentCMS.Web.UI/Pages/Sites/SiteList.razor
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
@page "/sites"
@page "/admin/sites"
@inject HttpClient _httpClient;
@inject IJSRuntime _jsRuntime;
@using FluentCMS.Entities.Sites

<h3>Sites</h3>
<p>List of all sites.</p>
<NavigationButton To="/sites/create">Create</NavigationButton>
<NavigationButton To="/admin/sites/create">Create</NavigationButton>
@if (sites == null)
{
<p>Loading...</p>
Expand Down Expand Up @@ -38,7 +38,7 @@ else
}
</td>
<td>
<NavigationButton To="@("/sites/edit/" + site.Id)">Edit</NavigationButton>
<NavigationButton To="@("/admin/sites/edit/" + site.Id)">Edit</NavigationButton>
<Button Color="Colors.Danger" @onclick="@(()=>Delete(site.Id))">Delete</Button>
</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions src/FluentCMS.Web.UI/Pages/Users/RoleEdit.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page "/roles/create"
@page "/roles/edit/{Id:guid}"
@page "/admin/roles/create"
@page "/admin/roles/edit/{Id:guid}"
@inject HttpClient _httpClient
@inject NavigationManager _navigationManager

Expand Down
6 changes: 3 additions & 3 deletions src/FluentCMS.Web.UI/Pages/Users/RoleList.razor
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@page "/roles"
@page "/admin/roles"
@inject HttpClient httpClient

<h3>Roles</h3>
<p>List of all roles.</p>
<NavigationButton To="/roles/create">Create</NavigationButton>
<NavigationButton To="/admin/roles/create">Create</NavigationButton>

@if (roles == null)
{
Expand All @@ -28,7 +28,7 @@ else
<td>@role.Description</td>
<td>@role.AutoAssigned.ToString()</td>
<td>
<NavigationButton To="@("/roles/edit/" + role.Id)">Edit</NavigationButton>
<NavigationButton To="@("/admin/roles/edit/" + role.Id)">Edit</NavigationButton>
<Button @onclick="() => OnDeleteClick(role.Id)">Delete</Button>
</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions src/FluentCMS.Web.UI/Pages/Users/UserEdit.razor
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@page "/users/create"
@page "/users/edit/{Id:guid}"
@page "/admin/users/create"
@page "/admin/users/edit/{Id:guid}"
@inject HttpClient _httpClient
@inject NavigationManager _navigationManager

Expand Down
6 changes: 3 additions & 3 deletions src/FluentCMS.Web.UI/Pages/Users/UserList.razor
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
@page "/users"
@page "/admin/users"
@inject HttpClient httpClient

<h3>Users</h3>
<p>List of all users.</p>
<NavigationButton To="/users/create">Create</NavigationButton>
<NavigationButton To="/admin/users/create">Create</NavigationButton>

@if (users == null)
{
Expand All @@ -26,7 +26,7 @@ else
<td>@user.Name</td>
<td>@user.Username</td>
<td>
<NavigationButton To="@("/users/edit/" + user.Id)">Edit</NavigationButton>
<NavigationButton To="@("/admin/users/edit/" + user.Id)">Edit</NavigationButton>
<Button @onclick="() => OnDeleteClick(user.Id)">Delete</Button>
</td>
</tr>
Expand Down
9 changes: 9 additions & 0 deletions src/FluentCMS.Web.UI/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
app.UseExceptionHandler("/Error", createScopeForErrors: true);
}

app.UseRouting();
app.UseStaticFiles();

app.UseAntiforgery();
Expand All @@ -63,6 +64,14 @@

app.UseAuthorization();

app.UseEndpoints(endpoints =>
{
_ = endpoints.MapGet("/", (context) =>
{
context.Response.Redirect("/admin");
return Task.CompletedTask;
});
});
app.MapControllers();

app.MapRazorComponents<App>()
Expand Down

0 comments on commit cab3d12

Please sign in to comment.