-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
741 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
35 changes: 35 additions & 0 deletions
35
samples/ServerRender/Sample.ServerRender.Web/Components/App.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
|
||
<base href="/" /> | ||
|
||
<link rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
integrity="sha256-PI8n5gCcz9cQqQXm3PEtDuPG8qx9oFsFctPg0S5zb8g=" | ||
crossorigin="anonymous"> | ||
|
||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.min.css" | ||
integrity="sha256-9kPW/n5nn53j4WMRYAxe9c1rCY96Oogo/MKSVdKzPmI=" | ||
crossorigin="anonymous"> | ||
|
||
<link rel="stylesheet" href="Sample.ServerRender.Web.styles.css" /> | ||
<link rel="stylesheet" href="app.css" /> | ||
|
||
<HeadOutlet @rendermode="InteractiveServer" /> | ||
</head> | ||
|
||
<body> | ||
<Routes @rendermode="InteractiveServer" /> | ||
|
||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" | ||
integrity="sha256-CDOy6cOibCWEdsRiZuaHf8dSGGJRYuBGC+mjoJimHGw=" | ||
crossorigin="anonymous"></script> | ||
|
||
<script src="_framework/blazor.web.js"></script> | ||
</body> | ||
|
||
</html> |
15 changes: 15 additions & 0 deletions
15
samples/ServerRender/Sample.ServerRender.Web/Components/Layout/MainLayout.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
@inherits LayoutComponentBase | ||
|
||
<Navigation /> | ||
|
||
<main role="main"> | ||
@Body | ||
</main> | ||
|
||
<Footer /> | ||
|
||
<div id="blazor-error-ui"> | ||
An unhandled error has occurred. | ||
<a href="" class="reload">Reload</a> | ||
<a class="dismiss">🗙</a> | ||
</div> |
18 changes: 18 additions & 0 deletions
18
samples/ServerRender/Sample.ServerRender.Web/Components/Layout/MainLayout.razor.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#blazor-error-ui { | ||
background: lightyellow; | ||
bottom: 0; | ||
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); | ||
display: none; | ||
left: 0; | ||
padding: 0.6rem 1.25rem 0.7rem 1.25rem; | ||
position: fixed; | ||
width: 100%; | ||
z-index: 1000; | ||
} | ||
|
||
#blazor-error-ui .dismiss { | ||
cursor: pointer; | ||
position: absolute; | ||
right: 0.75rem; | ||
top: 0.5rem; | ||
} |
40 changes: 40 additions & 0 deletions
40
samples/ServerRender/Sample.ServerRender.Web/Components/Pages/Claims.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
@page "/claims" | ||
|
||
@using Microsoft.AspNetCore.Authorization | ||
|
||
@attribute [Authorize] | ||
|
||
<PageTitle>Authorization Claims</PageTitle> | ||
|
||
<div class="container-xxl"> | ||
<AuthorizeView Context="user"> | ||
<Authorized> | ||
<h1>You are authenticated</h1> | ||
|
||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>Type</th> | ||
<th>Value</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach (var claim in user.User.Claims) | ||
{ | ||
<tr> | ||
<td>@claim.Type</td> | ||
<td>@claim.Value</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> | ||
</Authorized> | ||
<NotAuthorized> | ||
<h1>You are not authenticated</h1> | ||
</NotAuthorized> | ||
</AuthorizeView> | ||
</div> | ||
|
||
@code { | ||
|
||
} |
20 changes: 20 additions & 0 deletions
20
samples/ServerRender/Sample.ServerRender.Web/Components/Pages/Counter.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@page "/counter" | ||
|
||
<PageTitle>Counter</PageTitle> | ||
|
||
<div class="container-xxl"> | ||
<h1>Counter</h1> | ||
|
||
<p role="status">Current count: @currentCount</p> | ||
|
||
<button class="btn btn-primary" @onclick="IncrementCount">Click me</button> | ||
</div> | ||
|
||
@code { | ||
private int currentCount = 0; | ||
|
||
private void IncrementCount() | ||
{ | ||
currentCount++; | ||
} | ||
} |
36 changes: 36 additions & 0 deletions
36
samples/ServerRender/Sample.ServerRender.Web/Components/Pages/Error.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
@page "/Error" | ||
@using System.Diagnostics | ||
|
||
<PageTitle>Error</PageTitle> | ||
|
||
<h1 class="text-danger">Error.</h1> | ||
<h2 class="text-danger">An error occurred while processing your request.</h2> | ||
|
||
@if (ShowRequestId) | ||
{ | ||
<p> | ||
<strong>Request ID:</strong> <code>@RequestId</code> | ||
</p> | ||
} | ||
|
||
<h3>Development Mode</h3> | ||
<p> | ||
Swapping to <strong>Development</strong> environment will display more detailed information about the error that occurred. | ||
</p> | ||
<p> | ||
<strong>The Development environment shouldn't be enabled for deployed applications.</strong> | ||
It can result in displaying sensitive information from exceptions to end users. | ||
For local debugging, enable the <strong>Development</strong> environment by setting the <strong>ASPNETCORE_ENVIRONMENT</strong> environment variable to <strong>Development</strong> | ||
and restarting the app. | ||
</p> | ||
|
||
@code{ | ||
[CascadingParameter] | ||
private HttpContext? HttpContext { get; set; } | ||
|
||
private string? RequestId { get; set; } | ||
private bool ShowRequestId => !string.IsNullOrEmpty(RequestId); | ||
|
||
protected override void OnInitialized() => | ||
RequestId = Activity.Current?.Id ?? HttpContext?.TraceIdentifier; | ||
} |
14 changes: 14 additions & 0 deletions
14
samples/ServerRender/Sample.ServerRender.Web/Components/Pages/Index.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
@page "/" | ||
|
||
<PageTitle>Home</PageTitle> | ||
|
||
<div class="container-xxl"> | ||
<div class="bg-light p-5 rounded"> | ||
<h1> | ||
Blazone | ||
</h1> | ||
<p class="lead"> | ||
Blazone is a simple authentication module for Blazor | ||
</p> | ||
</div> | ||
</div> |
48 changes: 48 additions & 0 deletions
48
samples/ServerRender/Sample.ServerRender.Web/Components/Pages/Weather.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@page "/weather" | ||
@inject WeatherForecastService WeatherForecastService | ||
|
||
<PageTitle>Weather</PageTitle> | ||
|
||
<div class="container-xxl"> | ||
<h1>Weather</h1> | ||
|
||
<p>This component demonstrates fetching data from the server.</p> | ||
|
||
@if (forecasts == null) | ||
{ | ||
<p><em>Loading...</em></p> | ||
} | ||
else | ||
{ | ||
<table class="table"> | ||
<thead> | ||
<tr> | ||
<th>Date</th> | ||
<th>Temp. (C)</th> | ||
<th>Temp. (F)</th> | ||
<th>Summary</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
@foreach (var forecast in forecasts) | ||
{ | ||
<tr> | ||
<td>@forecast.Date.ToShortDateString()</td> | ||
<td>@forecast.TemperatureC</td> | ||
<td>@forecast.TemperatureF</td> | ||
<td>@forecast.Summary</td> | ||
</tr> | ||
} | ||
</tbody> | ||
</table> | ||
} | ||
</div> | ||
|
||
@code { | ||
private WeatherForecast[]? forecasts; | ||
|
||
protected override void OnInitialized() | ||
{ | ||
forecasts = WeatherForecastService.Get().ToArray(); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
samples/ServerRender/Sample.ServerRender.Web/Components/Routes.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<Router AppAssembly="@typeof(App).Assembly"> | ||
<Found Context="routeData"> | ||
<AuthorizeRouteView RouteData="routeData" DefaultLayout="typeof(MainLayout)"> | ||
<Authorizing> | ||
<Loading /> | ||
</Authorizing> | ||
<NotAuthorized> | ||
<SignIn /> | ||
</NotAuthorized> | ||
</AuthorizeRouteView> | ||
<FocusOnNavigate RouteData="@routeData" Selector="h1" /> | ||
</Found> | ||
<NotFound> | ||
<PageTitle>Not found</PageTitle> | ||
<LayoutView Layout="@typeof(MainLayout)"> | ||
<NotFound /> | ||
</LayoutView> | ||
</NotFound> | ||
</Router> |
17 changes: 17 additions & 0 deletions
17
samples/ServerRender/Sample.ServerRender.Web/Components/Shared/AccessDenied.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<div class="container"> | ||
<div class="row"> | ||
<div class="col-lg-6 mx-auto py-5"> | ||
<div class="card border-danger"> | ||
<div class="card-header text-white bg-danger"> | ||
<i class="fas fa-exclamation-triangle"></i> Access Denied | ||
</div> | ||
<div class="card-body text-danger"> | ||
<p> | ||
You do not have access to this resource. | ||
</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
|
26 changes: 26 additions & 0 deletions
26
samples/ServerRender/Sample.ServerRender.Web/Components/Shared/Conditional.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@if (Condition) | ||
{ | ||
if (Passed != null) | ||
{ | ||
@Passed | ||
} | ||
else if (ChildContent != null) | ||
{ | ||
@ChildContent | ||
} | ||
} | ||
else if (Failed != null) | ||
{ | ||
@Failed | ||
} | ||
|
||
@code { | ||
|
||
[Parameter] public bool Condition { get; set; } | ||
|
||
[Parameter] public RenderFragment? ChildContent { get; set; } | ||
|
||
[Parameter] public RenderFragment? Passed { get; set; } | ||
|
||
[Parameter] public RenderFragment? Failed { get; set; } | ||
} |
18 changes: 18 additions & 0 deletions
18
samples/ServerRender/Sample.ServerRender.Web/Components/Shared/Footer.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<footer class="border-top footer text-muted d-print-none"> | ||
<div class="container-fluid"> | ||
<div class="row"> | ||
<div class="col-md text-center"> | ||
<a href="https://github.com/loresoft/Blazone/" | ||
title="GitHub Soure Code"> | ||
<i class="fab fa-github"></i> Source Code | ||
</a> | ||
</div> | ||
<div class="col-md-6 text-center"> | ||
Copyright © @DateTime.Now.Year LoreSoft. All Rights Reserved. | ||
</div> | ||
<div class="col-md text-center" style="white-space:nowrap;overflow:hidden;text-overflow:ellipsis;"> | ||
<span title="@ThisAssembly.InformationalVersion">Version @ThisAssembly.FileVersion</span> | ||
</div> | ||
</div> | ||
</div> | ||
</footer> |
11 changes: 11 additions & 0 deletions
11
samples/ServerRender/Sample.ServerRender.Web/Components/Shared/Loading.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<div class="d-flex justify-content-center mb-3"> | ||
<span class="spinner-border" style="width: 3rem; height: 3rem;" role="status"></span> | ||
</div> | ||
<h3 class="d-flex justify-content-center"> | ||
@Text | ||
</h3> | ||
|
||
@code { | ||
[Parameter] | ||
public string Text { get; set; } = "Loading ..."; | ||
} |
Oops, something went wrong.