Switched to MPA powered by Razor Pages

After reconsidering where I want to take this project, I realized that a MPA is more fitting.
This commit is contained in:
2021-07-20 19:08:57 -05:00
parent e0756e0967
commit 57f67391f1
141 changed files with 5292 additions and 22079 deletions

33
Props/Pages/About.cshtml Normal file
View File

@@ -0,0 +1,33 @@
@page
@using Props.Services
@inject IContentManager<AboutModel> ContentManager
@{
ViewData["Title"] = "About";
}
<div class="container d-flex flex-column align-items-center my-3">
<div class="concise text-center">
<h2 class="mb-3 mt-4">Features</h2>
<p>
@ContentManager.Content.features.description
</p>
</div>
<div style="width: 100%;" data-simplebar>
<div class="row px-2 py-4 flex-nowrap">
@foreach (dynamic feature in ContentManager.Content.features.list)
{
<div class="card mx-2" style="width: 32rem;">
<div class="card-body">
<h5 class="card-title">@feature.title</h5>
<h6 class="card-subtitle mb-3 text-muted">
<slot name="subtitle">@feature.subtitle</slot>
</h6>
<p class="card-text">
@feature.text
</p>
</div>
</div>
}
</div>
</div>
</div>

View File

@@ -0,0 +1,9 @@
using Microsoft.AspNetCore.Mvc.RazorPages;
namespace Props.Pages
{
public class AboutModel : PageModel
{
}
}

26
Props/Pages/Error.cshtml Normal file
View File

@@ -0,0 +1,26 @@
@page
@model ErrorModel
@{
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>
<h2 class="text-danger">An error occurred while processing your request.</h2>
@if (Model.ShowRequestId)
{
<p>
<strong>Request ID:</strong> <code>@Model.RequestId</code>
</p>
}
<h3>Development Mode</h3>
<p>
Swapping to the <strong>Development</strong> environment displays 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>

View File

@@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace Props.Pages
{
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
[IgnoreAntiforgeryToken]
public class ErrorModel : PageModel
{
public string RequestId { get; set; }
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId);
private readonly ILogger<ErrorModel> _logger;
public ErrorModel(ILogger<ErrorModel> logger)
{
_logger = logger;
}
public void OnGet()
{
RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier;
}
}
}

37
Props/Pages/Index.cshtml Normal file
View File

@@ -0,0 +1,37 @@
@page
@using Props.Services
@model IndexModel
@inject IContentManager<IndexModel> ContentManager
@{
ViewData["Title"] = "Home page";
}
<div class="jumbotron d-flex flex-column align-items-center">
<div>
<img alt="Props logo" src="./images/logo.svg" class="img-fluid" style="max-height: 540px;" />
</div>
<div class="text-center px-3 my-2 concise">
<h1 class="my-2">Props</h1>
<p>
@ContentManager.Content.description
</p>
</div>
</div>
<div class="jumbotron sub">
<div class="container d-flex flex-column align-items-center py-3 concise">
<i class="bi bi-search" style="font-size: 5rem;"></i>
<h2 class="mb-3 mt-4">@ContentManager.Content.help.title</h2>
<form class="concise my-4">
<div class="input-group">
<input type="text" class="form-control" placeholder="What are you looking for?" aria-label="Search" aria-describedby="search-btn">
<button class="btn btn-outline-primary" type="button" id="search-btn">Search</button>
</div>
</form>
<p class="text-center">
@ContentManager.Content.help.searchIntroduction
</p>
<p class="text-center">
@ContentManager.Content.help.additionalInfo
</p>
</div>
</div>

View File

@@ -0,0 +1,25 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace Props.Pages
{
public class IndexModel : PageModel
{
private readonly ILogger<IndexModel> _logger;
public IndexModel(ILogger<IndexModel> logger)
{
_logger = logger;
}
public void OnGet()
{
}
}
}

View File

@@ -0,0 +1,8 @@
@page
@model PrivacyModel
@{
ViewData["Title"] = "Privacy Policy";
}
<h1>@ViewData["Title"]</h1>
<p>Use this page to detail your site's privacy policy.</p>

View File

@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
namespace Props.Pages
{
public class PrivacyModel : PageModel
{
private readonly ILogger<PrivacyModel> _logger;
public PrivacyModel(ILogger<PrivacyModel> logger)
{
_logger = logger;
}
public void OnGet()
{
}
}
}

16
Props/Pages/Search.cshtml Normal file
View File

@@ -0,0 +1,16 @@
@page
@{
ViewData["Title"] = "Search";
ViewData["Specific"] = "Search";
}
<div class="container d-flex flex-column align-items-center">
<form class="my-4" style="width: 720px;">
<div class="input-group">
<input type="text" class="form-control" placeholder="What are you looking for?" aria-label="Search" aria-describedby="search-btn">
<input type="checkbox" class="btn-check" id="config-check-toggle" autocomplete="off">
<label class="btn btn-outline-secondary" for="config-check-toggle"><i class="bi bi-sliders"></i></label>
<button class="btn btn-outline-primary" type="button" id="search-btn">Search</button>
</div>
</form>
</div>

View File

@@ -0,0 +1,76 @@
@using Microsoft.AspNetCore.Identity
@using Props.Models
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewData["Title"] - Props</title>
<script src="~/js/site.js" asp-append-version="true"></script>
@if (!string.IsNullOrEmpty((ViewData["Specific"] as string)))
{
<script src="@($"~/js/specific/{(ViewData["Specific"])}.js")" asp-append-version="true"></script>
}
</head>
<body class="theme-light">
<header>
<nav id="nav">
<div class="container-fluid">
<a class="navbar-brand" asp-page="/">Props</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarContent">
<i class="bi bi-list" style="width: 100%; height: auto;"></i>
</button>
<div class="collapse navbar-collapse" id="navbarContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<nav-link class="nav-link" asp-page="Index">Home</nav-link>
</li>
<li class="nav-item">
<nav-link class="nav-link" asp-page="Search">Search</nav-link>
</li>
<li class="nav-item">
<nav-link class="nav-link" asp-page="About">About</nav-link>
</li>
</ul>
<ul class="navbar-nav mb-2 mb-lg-0">
@if (SignInManager.IsSignedIn(User))
{
<li class="nav-item">
<a class="nav-link" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @User.Identity.Name!</a>
</li>
<li class="nav-item">
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Page("/", new { area = "" })" method="post">
<button type="submit" class="nav-link btn btn-link">Logout</button>
</form>
</li>
}
else
{
<li class="nav-item">
<a class="nav-link" asp-area="Identity" asp-page="/Account/Register">Register</a>
</li>
<li class="nav-item">
<a class="nav-link" asp-area="Identity" asp-page="/Account/Login">Login</a>
</li>
}
</ul>
</div>
</div>
</nav>
</header>
<main role="main">
@RenderBody()
</main>
<footer id="footer">
&copy; 2021 - Props - <a asp-area="" asp-page="/Privacy">Privacy</a>
</footer>
@await RenderSectionAsync("Scripts", required: false)
</body>
</html>

View File

@@ -0,0 +1,27 @@
@using Microsoft.AspNetCore.Identity
@using Props.Models
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager
<ul class="navbar-nav">
@if (SignInManager.IsSignedIn(User))
{
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @User.Identity.Name!</a>
</li>
<li class="nav-item">
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Page("/", new { area = "" })" method="post">
<button type="submit" class="nav-link btn btn-link text-dark">Logout</button>
</form>
</li>
}
else
{
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Register">Register</a>
</li>
<li class="nav-item">
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Login">Login</a>
</li>
}
</ul>

View File

@@ -0,0 +1,2 @@
<script src="~/lib/jquery-validation/dist/jquery.validate.min.js"></script>
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"></script>

View File

@@ -0,0 +1,6 @@
@using Microsoft.AspNetCore.Identity
@using Props
@using Props.Data
@namespace Props.Pages
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
@addTagHelper *, Props

View File

@@ -0,0 +1,4 @@
@{
Layout = "_Layout";
ViewData["Specific"] = null;
}