Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: added home page to dashboard sample #41

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
32 changes: 32 additions & 0 deletions DashboardApplication/Pages/Index.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@page

@{
ViewData["Title"] = "Home page";
}

<h2>Module Endpoints</h2>
<ul>
<li>
DashboardApplication - <span class="badge badge-success">default</span> <span class="badge badge-success">customer-a</span> <span class="badge badge-success">customer-b</span>
<ul>
<li><a href="~/">Index Page</a></li>
<li><a href="~/admin">Admin Page</a></li>
</ul>
</li>
<li>
Module1 - <span class="badge badge-danger">default</span> <span class="badge badge-success">customer-a</span> <span class="badge badge-success">customer-b</span>
<ul>
<li><a href="@(Url.Action("Index", "Home", new { area = "Module1" }))">Module1 Home Index Controller Action</a></li>
<li><a asp-area="Module1" asp-page="/about">Module1 About Page</a></li>
<li><a href="@(Url.Action("Get", "WeatherForecast", new { area = "Module1" }))">Module1 WeatherForecast Get Controller Action</a></li>
<li><a href="~/Module1/Kittens.jpg">Module1 wwwroot Kittens.jpg</a></li>
</ul>
</li>
<li>
Module2 - <span class="badge badge-danger">default</span> <span class="badge badge-danger">customer-a</span> <span class="badge badge-success">customer-b</span>
<ul>
<li><a href="~/Module2/hello">Module2 Hello Middleware</a></li>
<li><a href="~/info">Module2 Info Middleware</a></li>
</ul>
</li>
</ul>
49 changes: 49 additions & 0 deletions DashboardApplication/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - DashboardApplication</title>
<link rel="stylesheet" href="/lib/bootstrap.min.css" />
<link rel="stylesheet" href="/css/site.css" />
</head>
<body>
<header>
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
<div class="container">
<a class="navbar-brand" href="/">DashboardApplication</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse d-sm-inline-flex">
<ul class="navbar-nav flex-grow-1">
<li class="nav-item">
<a class="nav-link text-dark" href="~/">Home</a>
</li>
</ul>
<span class="navbar-text">
ViewContext.View.Path: @ViewContext.View.Path
</span>
</div>
</div>
</nav>
</header>
<div class="container">
<main role="main" class="pb-3">
@RenderBody()
</main>
</div>

<footer class="border-top footer text-muted">
<div class="container">
</div>
</footer>

<script src="/lib/jquery/dist/jquery.min.js"></script>
<script src="/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="/js/site.js" asp-append-version="true"></script>

@RenderSection("Scripts", required: false)
</body>
</html>
3 changes: 3 additions & 0 deletions DashboardApplication/Pages/_ViewImports.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@using DashboardApplication
@namespace DashboardApplication.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
3 changes: 3 additions & 0 deletions DashboardApplication/Pages/_ViewStart.cshtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@{
Layout = "_Layout";
}
15 changes: 1 addition & 14 deletions DashboardApplication/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,20 +35,7 @@
s.AddTagHelpers<ResourcesTagHelper>();
s.AddTagHelpers<ScriptTagHelper>();
s.AddTagHelpers<StyleTagHelper>();
})

// Fallback redirect to Admin dashboard
.Configure((app, routes, services) => {
var shellSettings = services.GetRequiredService<ShellSettings>();
var adminOptions = services.GetRequiredService<IOptions<AdminOptions>>();
routes.MapFallback("/", req =>
{
var redirectUrl = !String.IsNullOrEmpty(shellSettings.RequestUrlPrefix) ? $"/{shellSettings.RequestUrlPrefix}" : "";
redirectUrl += $"/{adminOptions.Value.AdminUrlPrefix}" ;
req.Response.Redirect(redirectUrl);
return Task.CompletedTask;
});
}, 10000);
});

var app = builder.Build();

Expand Down
2 changes: 2 additions & 0 deletions DashboardApplication/Recipes/dashboard.recipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"OrchardCore.Settings",
"OrchardCore.Themes",
"OrchardCore.Users",
"Module1",
"Module2",

// Themes
"TheAdmin",
Expand Down
Empty file.
Binary file added DashboardApplication/wwwroot/Kittens.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added DashboardApplication/wwwroot/favicon.ico
Binary file not shown.
7 changes: 7 additions & 0 deletions DashboardApplication/wwwroot/lib/bootstrap.min.css

Large diffs are not rendered by default.