From abd3f071aaa320c7524ef3b27f6aa63cb701decd Mon Sep 17 00:00:00 2001 From: jvyden Date: Tue, 30 Nov 2021 12:06:30 -0500 Subject: [PATCH] Add page titles to all pages --- ProjectLighthouse/Pages/AdminPanelPage.cshtml | 3 +-- ProjectLighthouse/Pages/LandingPage.cshtml | 1 + ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml | 13 ++++++++++++- .../Pages/Layouts/BaseLayout.cshtml.cs | 4 ++++ ProjectLighthouse/Pages/LoginForm.cshtml | 3 +-- ProjectLighthouse/Pages/LogoutPage.cshtml | 1 + ProjectLighthouse/Pages/PasswordResetPage.cshtml | 3 +-- .../Pages/PasswordResetRequiredPage.cshtml | 2 +- ProjectLighthouse/Pages/PhotosPage.cshtml | 2 +- ProjectLighthouse/Pages/RegisterForm.cshtml | 3 +-- ProjectLighthouse/Pages/SlotsPage.cshtml | 2 +- ProjectLighthouse/Pages/UserPage.cshtml | 4 +++- 12 files changed, 28 insertions(+), 13 deletions(-) diff --git a/ProjectLighthouse/Pages/AdminPanelPage.cshtml b/ProjectLighthouse/Pages/AdminPanelPage.cshtml index f9c92c5c..891e8891 100644 --- a/ProjectLighthouse/Pages/AdminPanelPage.cshtml +++ b/ProjectLighthouse/Pages/AdminPanelPage.cshtml @@ -5,10 +5,9 @@ @{ Layout = "Layouts/BaseLayout"; + Model.Title = "Admin Panel"; } -

Admin Panel

-

Commands

@foreach (ICommand command in MaintenanceHelper.Commands) diff --git a/ProjectLighthouse/Pages/LandingPage.cshtml b/ProjectLighthouse/Pages/LandingPage.cshtml index 312f9d1d..fc67aaae 100644 --- a/ProjectLighthouse/Pages/LandingPage.cshtml +++ b/ProjectLighthouse/Pages/LandingPage.cshtml @@ -4,6 +4,7 @@ @{ Layout = "Layouts/BaseLayout"; + Model.ShowTitleInPage = false; }

Welcome to Project Lighthouse!

diff --git a/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml index b33b3e30..4632137e 100644 --- a/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml +++ b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml @@ -32,7 +32,14 @@ - Project Lighthouse + @if (Model.Title == string.Empty) + { + Project Lighthouse + } + else + { + Project Lighthouse - @Model.Title + } @@ -93,6 +100,10 @@

+ @if (Model.ShowTitleInPage) + { +

@Model.Title

+ } @RenderBody()
@* makes it look nicer *@
diff --git a/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml.cs b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml.cs index e77b3f11..eaca0975 100644 --- a/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml.cs +++ b/ProjectLighthouse/Pages/Layouts/BaseLayout.cshtml.cs @@ -11,6 +11,10 @@ namespace LBPUnion.ProjectLighthouse.Pages.Layouts private User? user; + public string Title = string.Empty; + + public bool ShowTitleInPage = true; + public new User? User { get { if (this.user != null) return this.user; diff --git a/ProjectLighthouse/Pages/LoginForm.cshtml b/ProjectLighthouse/Pages/LoginForm.cshtml index b5b4b82d..d6ebed62 100644 --- a/ProjectLighthouse/Pages/LoginForm.cshtml +++ b/ProjectLighthouse/Pages/LoginForm.cshtml @@ -3,6 +3,7 @@ @{ Layout = "Layouts/BaseLayout"; + Model.Title = "Log in"; } @@ -16,8 +17,6 @@ return true; } - -

Log in

diff --git a/ProjectLighthouse/Pages/LogoutPage.cshtml b/ProjectLighthouse/Pages/LogoutPage.cshtml index ac65ce91..589ed4f5 100644 --- a/ProjectLighthouse/Pages/LogoutPage.cshtml +++ b/ProjectLighthouse/Pages/LogoutPage.cshtml @@ -3,6 +3,7 @@ @{ Layout = "Layouts/BaseLayout"; + Model.Title = "Logged out"; }

You have been successfully logged out. You will be redirected in 5 seconds, or you may click here to do so manually.

diff --git a/ProjectLighthouse/Pages/PasswordResetPage.cshtml b/ProjectLighthouse/Pages/PasswordResetPage.cshtml index e069274e..a9acf1b4 100644 --- a/ProjectLighthouse/Pages/PasswordResetPage.cshtml +++ b/ProjectLighthouse/Pages/PasswordResetPage.cshtml @@ -3,6 +3,7 @@ @{ Layout = "Layouts/BaseLayout"; + Model.Title = "Password Reset"; } @@ -19,8 +20,6 @@ } -

Password Reset

-
diff --git a/ProjectLighthouse/Pages/PasswordResetRequiredPage.cshtml b/ProjectLighthouse/Pages/PasswordResetRequiredPage.cshtml index 5dc62ef7..616d2f8a 100644 --- a/ProjectLighthouse/Pages/PasswordResetRequiredPage.cshtml +++ b/ProjectLighthouse/Pages/PasswordResetRequiredPage.cshtml @@ -3,9 +3,9 @@ @{ Layout = "Layouts/BaseLayout"; + Model.Title = "Password Reset Required"; } -

Password Reset Required

An admin has deemed it necessary that you reset your password. Please do so.

diff --git a/ProjectLighthouse/Pages/PhotosPage.cshtml b/ProjectLighthouse/Pages/PhotosPage.cshtml index 9cd07040..844165ca 100644 --- a/ProjectLighthouse/Pages/PhotosPage.cshtml +++ b/ProjectLighthouse/Pages/PhotosPage.cshtml @@ -4,9 +4,9 @@ @{ Layout = "Layouts/BaseLayout"; + Model.Title = "Photos"; } -

Photos

There are @Model.PhotoCount total photos!

@foreach (Photo photo in Model.Photos) diff --git a/ProjectLighthouse/Pages/RegisterForm.cshtml b/ProjectLighthouse/Pages/RegisterForm.cshtml index 175e6741..6a755f8c 100644 --- a/ProjectLighthouse/Pages/RegisterForm.cshtml +++ b/ProjectLighthouse/Pages/RegisterForm.cshtml @@ -3,6 +3,7 @@ @{ Layout = "Layouts/BaseLayout"; + Model.Title = "Register"; } @@ -19,8 +20,6 @@ } -

Register

-
diff --git a/ProjectLighthouse/Pages/SlotsPage.cshtml b/ProjectLighthouse/Pages/SlotsPage.cshtml index 3c2cef23..4af2a0bc 100644 --- a/ProjectLighthouse/Pages/SlotsPage.cshtml +++ b/ProjectLighthouse/Pages/SlotsPage.cshtml @@ -6,9 +6,9 @@ @{ Layout = "Layouts/BaseLayout"; + Model.Title = "Levels"; } -

Levels

There are @Model.SlotCount total levels!

@foreach (Slot slot in Model.Slots) diff --git a/ProjectLighthouse/Pages/UserPage.cshtml b/ProjectLighthouse/Pages/UserPage.cshtml index d9e127e3..d23cc01c 100644 --- a/ProjectLighthouse/Pages/UserPage.cshtml +++ b/ProjectLighthouse/Pages/UserPage.cshtml @@ -6,11 +6,13 @@ @{ Layout = "Layouts/BaseLayout"; + Model.Title = "Model.ProfileUser!.Username's user page"; + Model.ShowTitleInPage = false; }
-

@Model.ProfileUser!.Username's user page

+

@Model.Title

@Model.ProfileUser.Status