From 4892e016307a215a888eea9b36b3f7edc18748d1 Mon Sep 17 00:00:00 2001 From: Uncled1023 Date: Fri, 25 Jan 2019 21:16:01 -0800 Subject: [PATCH] Standardized the titles for all of the pages. --- .../Controllers/AccountController.cs | 6 +++++ .../Controllers/ConsentController.cs | 1 + .../Controllers/DefaultController.cs | 2 +- IdentityServer/Controllers/ErrorController.cs | 12 ++++----- .../Controllers/GrantsController.cs | 1 + IdentityServer/IdentityServer.csproj | 12 +++++++++ IdentityServer/Views/Shared/_Layout.cshtml | 11 +++++++- .../About/Controllers/AboutController.cs | 2 +- .../Abuse/Controllers/AbuseController.cs | 2 +- .../Areas/Blog/Controllers/BlogController.cs | 26 +++++++++---------- .../Contact/Controllers/ContactController.cs | 2 +- .../Error/Controllers/ErrorController.cs | 10 +++---- Teknik/Areas/FAQ/Controllers/FAQController.cs | 2 +- .../Areas/Help/Controllers/HelpController.cs | 24 ++++++++--------- .../Areas/Home/Controllers/HomeController.cs | 3 +-- .../Paste/Controllers/PasteController.cs | 4 +-- Teknik/Areas/Paste/Views/Paste/Simple.cshtml | 2 +- .../Podcast/Controllers/PodcastController.cs | 4 +-- .../Privacy/Controllers/PrivacyController.cs | 2 +- .../Controllers/ShortenerController.cs | 4 +-- .../Stats/Controllers/StatsController.cs | 2 +- Teknik/Areas/TOS/Controllers/TOSController.cs | 2 +- .../Upload/Controllers/UploadController.cs | 6 ++--- .../Areas/User/Controllers/UserController.cs | 26 +++++++++---------- .../Vault/Controllers/VaultController.cs | 4 +-- Teknik/Controllers/DefaultController.cs | 2 +- Teknik/Views/Shared/_Layout.cshtml | 11 +++++++- 27 files changed, 111 insertions(+), 74 deletions(-) diff --git a/IdentityServer/Controllers/AccountController.cs b/IdentityServer/Controllers/AccountController.cs index ee078e9..03594f5 100644 --- a/IdentityServer/Controllers/AccountController.cs +++ b/IdentityServer/Controllers/AccountController.cs @@ -59,6 +59,7 @@ namespace Teknik.IdentityServer.Controllers [HttpGet] public async Task Login(string returnUrl) { + ViewBag.Title = $"Sign in"; // build a model so we know what to show on the login page var vm = await _account.BuildLoginViewModelAsync(returnUrl); @@ -142,6 +143,7 @@ namespace Teknik.IdentityServer.Controllers [HttpGet] public async Task LoginWith2fa(bool rememberMe, string returnUrl = null) { + ViewBag.Title = "Two-Factor Authentication"; // Ensure the user has gone through the username & password screen first var user = await _signInManager.GetTwoFactorAuthenticationUserAsync(); @@ -193,6 +195,7 @@ namespace Teknik.IdentityServer.Controllers [HttpGet] public async Task LoginWithRecoveryCode(string returnUrl = null) { + ViewBag.Title = "Two-Factor Recovery Code"; // Ensure the user has gone through the username & password screen first var user = await _signInManager.GetTwoFactorAuthenticationUserAsync(); if (user == null) @@ -242,12 +245,14 @@ namespace Teknik.IdentityServer.Controllers [HttpGet] public IActionResult Lockout() { + ViewBag.Title = "Locked Out"; return View(); } [HttpGet] public IActionResult Banned() { + ViewBag.Title = "Banned"; return View(); } @@ -257,6 +262,7 @@ namespace Teknik.IdentityServer.Controllers [HttpGet] public async Task Logout(string logoutId) { + ViewBag.Title = "Logout"; // build a model so the logout page knows what to display var vm = await _account.BuildLogoutViewModelAsync(logoutId); diff --git a/IdentityServer/Controllers/ConsentController.cs b/IdentityServer/Controllers/ConsentController.cs index a7ee1fe..8cb70ef 100644 --- a/IdentityServer/Controllers/ConsentController.cs +++ b/IdentityServer/Controllers/ConsentController.cs @@ -37,6 +37,7 @@ namespace Teknik.IdentityServer.Controllers [HttpGet] public async Task Index(string returnUrl) { + ViewBag.Title = "Application Consent"; var vm = await _consent.BuildViewModelAsync(returnUrl); if (vm != null) { diff --git a/IdentityServer/Controllers/DefaultController.cs b/IdentityServer/Controllers/DefaultController.cs index b7fc1b5..ff9ddc7 100644 --- a/IdentityServer/Controllers/DefaultController.cs +++ b/IdentityServer/Controllers/DefaultController.cs @@ -23,7 +23,7 @@ namespace Teknik.IdentityServer.Controllers _logger = logger; _config = config; - ViewBag.Title = "Teknik Authentication"; + ViewBag.Title = string.Empty; ViewBag.Description = "Teknik Authentication Service"; } diff --git a/IdentityServer/Controllers/ErrorController.cs b/IdentityServer/Controllers/ErrorController.cs index 3ab39c6..f558614 100644 --- a/IdentityServer/Controllers/ErrorController.cs +++ b/IdentityServer/Controllers/ErrorController.cs @@ -44,7 +44,7 @@ namespace Teknik.IdentityServer.Controllers public IActionResult HttpGeneral(int statusCode) { - ViewBag.Title = statusCode + " - " + _config.Title; + ViewBag.Title = statusCode; LogError(LogLevel.Error, "HTTP Error Code: " + statusCode); @@ -59,7 +59,7 @@ namespace Teknik.IdentityServer.Controllers { Response.StatusCode = StatusCodes.Status401Unauthorized; - ViewBag.Title = "401 - " + _config.Title; + ViewBag.Title = "401"; ViewBag.Description = "Unauthorized"; LogError(LogLevel.Error, "Unauthorized"); @@ -75,7 +75,7 @@ namespace Teknik.IdentityServer.Controllers { Response.StatusCode = StatusCodes.Status403Forbidden; - ViewBag.Title = "403 - " + _config.Title; + ViewBag.Title = "403"; ViewBag.Description = "Access Denied"; LogError(LogLevel.Error, "Access Denied"); @@ -91,7 +91,7 @@ namespace Teknik.IdentityServer.Controllers { Response.StatusCode = StatusCodes.Status404NotFound; - ViewBag.Title = "404 - " + _config.Title; + ViewBag.Title = "404"; ViewBag.Description = "Uh Oh, can't find it!"; LogError(LogLevel.Warning, "Page Not Found"); @@ -117,7 +117,7 @@ namespace Teknik.IdentityServer.Controllers Response.StatusCode = StatusCodes.Status500InternalServerError; - ViewBag.Title = "500 - " + _config.Title; + ViewBag.Title = "500"; ViewBag.Description = "Something Borked"; LogError(LogLevel.Error, "Server Error", exception); @@ -136,7 +136,7 @@ namespace Teknik.IdentityServer.Controllers Response.StatusCode = StatusCodes.Status500InternalServerError; - ViewBag.Title = "Identity Error - " + _config.Title; + ViewBag.Title = "Identity Error"; ViewBag.Description = "The Identity Service threw an error"; LogError(LogLevel.Error, "Identity Error: " + message.Error); diff --git a/IdentityServer/Controllers/GrantsController.cs b/IdentityServer/Controllers/GrantsController.cs index a6e16a3..2df571a 100644 --- a/IdentityServer/Controllers/GrantsController.cs +++ b/IdentityServer/Controllers/GrantsController.cs @@ -41,6 +41,7 @@ namespace Teknik.IdentityServer.Controllers [HttpGet] public async Task Index() { + ViewBag.Title = "Granted Applications"; return View("Index", await BuildViewModelAsync()); } diff --git a/IdentityServer/IdentityServer.csproj b/IdentityServer/IdentityServer.csproj index 688a848..2273dbb 100644 --- a/IdentityServer/IdentityServer.csproj +++ b/IdentityServer/IdentityServer.csproj @@ -32,4 +32,16 @@ + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + diff --git a/IdentityServer/Views/Shared/_Layout.cshtml b/IdentityServer/Views/Shared/_Layout.cshtml index 858b874..8e270a9 100644 --- a/IdentityServer/Views/Shared/_Layout.cshtml +++ b/IdentityServer/Views/Shared/_Layout.cshtml @@ -29,7 +29,16 @@ - @ViewBag.Title + + @if (string.IsNullOrEmpty(ViewBag.Title)) + { + <text>@Config.Title</text> + } + else + { + <text>@ViewBag.Title | @Config.Title</text> + } + diff --git a/Teknik/Areas/About/Controllers/AboutController.cs b/Teknik/Areas/About/Controllers/AboutController.cs index a3a7955..aae20e8 100644 --- a/Teknik/Areas/About/Controllers/AboutController.cs +++ b/Teknik/Areas/About/Controllers/AboutController.cs @@ -24,7 +24,7 @@ namespace Teknik.Areas.About.Controllers [AllowAnonymous] public IActionResult Index([FromServices] Config config) { - ViewBag.Title = "About - " + config.Title; + ViewBag.Title = "About"; ViewBag.Description = "What is Teknik?"; return View(new AboutViewModel()); diff --git a/Teknik/Areas/Abuse/Controllers/AbuseController.cs b/Teknik/Areas/Abuse/Controllers/AbuseController.cs index 46c3c8a..0a4cb6a 100644 --- a/Teknik/Areas/Abuse/Controllers/AbuseController.cs +++ b/Teknik/Areas/Abuse/Controllers/AbuseController.cs @@ -24,7 +24,7 @@ namespace Teknik.Areas.Abuse.Controllers [AllowAnonymous] public IActionResult Index() { - ViewBag.Title = "Abuse Reporting - " + _config.Title; + ViewBag.Title = "Abuse Reporting"; ViewBag.Description = "Methods for reporting abuse reports to Teknik Services."; return View(new AbuseViewModel()); diff --git a/Teknik/Areas/Blog/Controllers/BlogController.cs b/Teknik/Areas/Blog/Controllers/BlogController.cs index 41958b8..bf51059 100644 --- a/Teknik/Areas/Blog/Controllers/BlogController.cs +++ b/Teknik/Areas/Blog/Controllers/BlogController.cs @@ -36,7 +36,7 @@ namespace Teknik.Areas.Blog.Controllers // The blog is the main site's blog if (string.IsNullOrEmpty(username)) { - ViewBag.Title = _config.BlogConfig.Title + " - " + _config.Title; + ViewBag.Title = _config.BlogConfig.Title; ViewBag.Description = _config.BlogConfig.Description; bool isAuth = User.IsInRole("Admin"); model = new BlogViewModel(); @@ -78,10 +78,10 @@ namespace Teknik.Areas.Blog.Controllers // find the blog specified if (blog != null) { - ViewBag.Title = blog.User.Username + "'s Blog - " + _config.Title; + ViewBag.Title = blog.User.Username + "'s Blog"; if (!string.IsNullOrEmpty(blog.User.BlogSettings.Title)) { - ViewBag.Title = blog.User.BlogSettings.Title + " - " + ViewBag.Title; + ViewBag.Title = blog.User.BlogSettings.Title; } ViewBag.Description = blog.User.BlogSettings.Description; bool isAuth = User.IsInRole("Admin"); @@ -141,17 +141,17 @@ namespace Teknik.Areas.Blog.Controllers if (post.System) { - ViewBag.Title = model.Title + " - " + _config.BlogConfig.Title + " - " + _config.Title; + ViewBag.Title = model.Title + " | " + _config.BlogConfig.Title; ViewBag.Description = _config.BlogConfig.Description; } else { - ViewBag.Title = username + "'s Blog - " + _config.Title; + ViewBag.Title = username + "'s Blog"; if (!string.IsNullOrEmpty(post.Blog.User.BlogSettings.Title)) { - ViewBag.Title = post.Blog.User.BlogSettings.Title + " - " + ViewBag.Title; + ViewBag.Title = post.Blog.User.BlogSettings.Title + " | " + ViewBag.Title; } - ViewBag.Title = model.Title + " - " + ViewBag.Title; + ViewBag.Title = model.Title + " | " + ViewBag.Title; ViewBag.Description = post.Blog.User.BlogSettings.Description; } return View("~/Areas/Blog/Views/Blog/ViewPost.cshtml", model); @@ -180,12 +180,12 @@ namespace Teknik.Areas.Blog.Controllers model = new BlogViewModel(blog); if (blog.User.Username == Constants.SERVERUSER) { - ViewBag.Title = "Create Post - " + _config.BlogConfig.Title + " - " + _config.Title; + ViewBag.Title = "Create Post | " + _config.BlogConfig.Title; ViewBag.Description = _config.BlogConfig.Description; } else { - ViewBag.Title = username + "'s Blog - " + _config.Title; + ViewBag.Title = username + "'s Blog | " + _config.Title; if (!string.IsNullOrEmpty(blog.User.BlogSettings.Title)) { ViewBag.Title = blog.User.BlogSettings.Title + " - " + ViewBag.Title; @@ -223,17 +223,17 @@ namespace Teknik.Areas.Blog.Controllers if (post.System) { - ViewBag.Title = "Edit Post - " + model.Title + " - " + _config.BlogConfig.Title + " - " + _config.Title; + ViewBag.Title = "Edit Post | " + model.Title + " | " + _config.BlogConfig.Title; ViewBag.Description = _config.BlogConfig.Description; } else { - ViewBag.Title = username + "'s Blog - " + _config.Title; + ViewBag.Title = username + "'s Blog"; if (!string.IsNullOrEmpty(post.Blog.User.BlogSettings.Title)) { - ViewBag.Title = post.Blog.User.BlogSettings.Title + " - " + ViewBag.Title; + ViewBag.Title = post.Blog.User.BlogSettings.Title + " | " + ViewBag.Title; } - ViewBag.Title = "Edit Post - " + model.Title + " - " + ViewBag.Title; + ViewBag.Title = "Edit Post | " + model.Title + " | " + ViewBag.Title; ViewBag.Description = post.Blog.User.BlogSettings.Description; } return View("~/Areas/Blog/Views/Blog/EditPost.cshtml", model); diff --git a/Teknik/Areas/Contact/Controllers/ContactController.cs b/Teknik/Areas/Contact/Controllers/ContactController.cs index 478ce78..3d0d0a3 100644 --- a/Teknik/Areas/Contact/Controllers/ContactController.cs +++ b/Teknik/Areas/Contact/Controllers/ContactController.cs @@ -28,7 +28,7 @@ namespace Teknik.Areas.Contact.Controllers [AllowAnonymous] public IActionResult Index() { - ViewBag.Title = "Contact - " + _config.Title; + ViewBag.Title = "Contact Us"; ViewBag.Description = "Contact Teknik Support"; return View(new ContactViewModel()); diff --git a/Teknik/Areas/Error/Controllers/ErrorController.cs b/Teknik/Areas/Error/Controllers/ErrorController.cs index 8dae0d8..530395e 100644 --- a/Teknik/Areas/Error/Controllers/ErrorController.cs +++ b/Teknik/Areas/Error/Controllers/ErrorController.cs @@ -46,7 +46,7 @@ namespace Teknik.Areas.Error.Controllers [AllowAnonymous] public IActionResult HttpGeneral(int statusCode) { - ViewBag.Title = statusCode + " - " + _config.Title; + ViewBag.Title = statusCode; LogError(LogLevel.Error, "HTTP Error Code: " + statusCode); @@ -61,7 +61,7 @@ namespace Teknik.Areas.Error.Controllers { Response.StatusCode = StatusCodes.Status401Unauthorized; - ViewBag.Title = "401 - " + _config.Title; + ViewBag.Title = "401"; ViewBag.Description = "Unauthorized"; LogError(LogLevel.Error, "Unauthorized"); @@ -77,7 +77,7 @@ namespace Teknik.Areas.Error.Controllers { Response.StatusCode = StatusCodes.Status403Forbidden; - ViewBag.Title = "403 - " + _config.Title; + ViewBag.Title = "403"; ViewBag.Description = "Access Denied"; LogError(LogLevel.Error, "Access Denied"); @@ -93,7 +93,7 @@ namespace Teknik.Areas.Error.Controllers { Response.StatusCode = StatusCodes.Status404NotFound; - ViewBag.Title = "404 - " + _config.Title; + ViewBag.Title = "404"; ViewBag.Description = "Uh Oh, can't find it!"; LogError(LogLevel.Warning, "Page Not Found"); @@ -124,7 +124,7 @@ namespace Teknik.Areas.Error.Controllers Response.StatusCode = StatusCodes.Status500InternalServerError; - ViewBag.Title = "500 - " + _config.Title; + ViewBag.Title = "500"; ViewBag.Description = "Something Borked"; LogError(LogLevel.Error, "Server Error", exception); diff --git a/Teknik/Areas/FAQ/Controllers/FAQController.cs b/Teknik/Areas/FAQ/Controllers/FAQController.cs index 350d81d..3cb3ae8 100644 --- a/Teknik/Areas/FAQ/Controllers/FAQController.cs +++ b/Teknik/Areas/FAQ/Controllers/FAQController.cs @@ -20,7 +20,7 @@ namespace Teknik.Areas.FAQ.Controllers [AllowAnonymous] public IActionResult Index() { - ViewBag.Title = "Frequently Asked Questions - " + _config.Title; + ViewBag.Title = "Frequently Asked Questions"; FAQViewModel model = new FAQViewModel(); return View(model); } diff --git a/Teknik/Areas/Help/Controllers/HelpController.cs b/Teknik/Areas/Help/Controllers/HelpController.cs index aa4ddef..7709146 100644 --- a/Teknik/Areas/Help/Controllers/HelpController.cs +++ b/Teknik/Areas/Help/Controllers/HelpController.cs @@ -21,7 +21,7 @@ namespace Teknik.Areas.Help.Controllers [AllowAnonymous] public IActionResult Index() { - ViewBag.Title = "Help - " + _config.Title; + ViewBag.Title = "Help"; HelpViewModel model = new HelpViewModel(); return View(model); } @@ -32,12 +32,12 @@ namespace Teknik.Areas.Help.Controllers HelpViewModel model = new HelpViewModel(); if (string.IsNullOrEmpty(version) && string.IsNullOrEmpty(service)) { - ViewBag.Title = "API Help - " + _config.Title; + ViewBag.Title = "API Help"; return View("~/Areas/Help/Views/Help/API/API.cshtml", model); } else if(!string.IsNullOrEmpty(version) && !string.IsNullOrEmpty(service)) { - ViewBag.Title = service + " API " + version + " Help - " + _config.Title; + ViewBag.Title = service + " API " + version + " Help"; return View("~/Areas/Help/Views/Help/API/" + version + "/" + service + ".cshtml", model); } return new StatusCodeResult(StatusCodes.Status404NotFound); @@ -46,7 +46,7 @@ namespace Teknik.Areas.Help.Controllers [AllowAnonymous] public IActionResult Blog() { - ViewBag.Title = "Blogging Help - " + _config.Title; + ViewBag.Title = "Blogging Help"; HelpViewModel model = new HelpViewModel(); return View("~/Areas/Help/Views/Help/Blog.cshtml", model); } @@ -54,7 +54,7 @@ namespace Teknik.Areas.Help.Controllers [AllowAnonymous] public IActionResult Git() { - ViewBag.Title = "Git Service Help - " + _config.Title; + ViewBag.Title = "Git Service Help"; HelpViewModel model = new HelpViewModel(); return View("~/Areas/Help/Views/Help/Git.cshtml", model); } @@ -62,7 +62,7 @@ namespace Teknik.Areas.Help.Controllers [AllowAnonymous] public IActionResult IRC() { - ViewBag.Title = "IRC Server Help - " + _config.Title; + ViewBag.Title = "IRC Server Help "; HelpViewModel model = new HelpViewModel(); return View("~/Areas/Help/Views/Help/IRC.cshtml", model); } @@ -70,7 +70,7 @@ namespace Teknik.Areas.Help.Controllers [AllowAnonymous] public IActionResult Mail() { - ViewBag.Title = "Mail Server Help - " + _config.Title; + ViewBag.Title = "Mail Server Help"; HelpViewModel model = new HelpViewModel(); return View("~/Areas/Help/Views/Help/Mail.cshtml", model); } @@ -78,7 +78,7 @@ namespace Teknik.Areas.Help.Controllers [AllowAnonymous] public IActionResult Markdown() { - ViewBag.Title = "Markdown Help - " + _config.Title; + ViewBag.Title = "Markdown Help"; HelpViewModel model = new HelpViewModel(); return View("~/Areas/Help/Views/Help/Markdown.cshtml", model); } @@ -86,7 +86,7 @@ namespace Teknik.Areas.Help.Controllers [AllowAnonymous] public IActionResult Mumble() { - ViewBag.Title = "Mumble Server Help - " + _config.Title; + ViewBag.Title = "Mumble Server Help"; HelpViewModel model = new HelpViewModel(); return View("~/Areas/Help/Views/Help/Mumble.cshtml", model); } @@ -94,7 +94,7 @@ namespace Teknik.Areas.Help.Controllers [AllowAnonymous] public IActionResult RSS() { - ViewBag.Title = "RSS Help - " + _config.Title; + ViewBag.Title = "RSS Help"; HelpViewModel model = new HelpViewModel(); return View("~/Areas/Help/Views/Help/RSS.cshtml", model); } @@ -102,7 +102,7 @@ namespace Teknik.Areas.Help.Controllers [AllowAnonymous] public IActionResult Tools() { - ViewBag.Title = "Tool Help - " + _config.Title; + ViewBag.Title = "Tool Help"; HelpViewModel model = new HelpViewModel(); return View("~/Areas/Help/Views/Help/Tools.cshtml", model); } @@ -110,7 +110,7 @@ namespace Teknik.Areas.Help.Controllers [AllowAnonymous] public IActionResult Upload() { - ViewBag.Title = "Upload Service Help - " + _config.Title; + ViewBag.Title = "Upload Service Help"; HelpViewModel model = new HelpViewModel(); return View("~/Areas/Help/Views/Help/Upload.cshtml", model); } diff --git a/Teknik/Areas/Home/Controllers/HomeController.cs b/Teknik/Areas/Home/Controllers/HomeController.cs index 6cf725a..6c633f4 100644 --- a/Teknik/Areas/Home/Controllers/HomeController.cs +++ b/Teknik/Areas/Home/Controllers/HomeController.cs @@ -42,8 +42,7 @@ namespace Teknik.Areas.Home.Controllers model.SitePosts = lastSite; model.Podcasts = lastPods; - - ViewBag.Title = _config.Title; + return View(model); } } diff --git a/Teknik/Areas/Paste/Controllers/PasteController.cs b/Teknik/Areas/Paste/Controllers/PasteController.cs index 6cabab5..21a1855 100644 --- a/Teknik/Areas/Paste/Controllers/PasteController.cs +++ b/Teknik/Areas/Paste/Controllers/PasteController.cs @@ -33,7 +33,7 @@ namespace Teknik.Areas.Paste.Controllers [AllowAnonymous] public IActionResult Index() { - ViewBag.Title = "Paste - " + _config.Title; + ViewBag.Title = "Pastebin"; ViewBag.Description = "Paste your code or text easily and securely. Set an expiration, set a password, or leave it open for the world to see."; PasteCreateViewModel model = new PasteCreateViewModel(); return View(model); @@ -45,7 +45,7 @@ namespace Teknik.Areas.Paste.Controllers Models.Paste paste = _dbContext.Pastes.Where(p => p.Url == url).FirstOrDefault(); if (paste != null) { - ViewBag.Title = ((string.IsNullOrEmpty(paste.Title)) ? string.Empty : paste.Title + " - ") + _config.Title + " Paste"; + ViewBag.Title = paste.Title + " | Pastebin"; ViewBag.Description = "Paste your code or text easily and securely. Set an expiration, set a password, or leave it open for the world to see."; // Increment Views paste.Views += 1; diff --git a/Teknik/Areas/Paste/Views/Paste/Simple.cshtml b/Teknik/Areas/Paste/Views/Paste/Simple.cshtml index 35bdecf..fa09940 100644 --- a/Teknik/Areas/Paste/Views/Paste/Simple.cshtml +++ b/Teknik/Areas/Paste/Views/Paste/Simple.cshtml @@ -19,7 +19,7 @@ - @ViewBag.Title + @ViewBag.Title | @Config.Title diff --git a/Teknik/Areas/Podcast/Controllers/PodcastController.cs b/Teknik/Areas/Podcast/Controllers/PodcastController.cs index cf296ca..9037fb8 100644 --- a/Teknik/Areas/Podcast/Controllers/PodcastController.cs +++ b/Teknik/Areas/Podcast/Controllers/PodcastController.cs @@ -36,7 +36,7 @@ namespace Teknik.Areas.Podcast.Controllers model.Description = _config.PodcastConfig.Description; try { - ViewBag.Title = _config.PodcastConfig.Title + " - " + _config.Title; + ViewBag.Title = _config.PodcastConfig.Title; ViewBag.Description = _config.PodcastConfig.Description; bool editor = User.IsInRole("Podcast"); var foundPodcasts = _dbContext.Podcasts.Where(p => (p.Published || editor)).FirstOrDefault(); @@ -73,7 +73,7 @@ namespace Teknik.Areas.Podcast.Controllers { model = new PodcastViewModel(foundPodcast); - ViewBag.Title = model.Title + " - Teknikast - " + _config.Title; + ViewBag.Title = model.Title + " | Teknikast"; return View("~/Areas/Podcast/Views/Podcast/ViewPodcast.cshtml", model); } model.Error = true; diff --git a/Teknik/Areas/Privacy/Controllers/PrivacyController.cs b/Teknik/Areas/Privacy/Controllers/PrivacyController.cs index cf946d8..8e22fee 100644 --- a/Teknik/Areas/Privacy/Controllers/PrivacyController.cs +++ b/Teknik/Areas/Privacy/Controllers/PrivacyController.cs @@ -20,7 +20,7 @@ namespace Teknik.Areas.Privacy.Controllers [AllowAnonymous] public IActionResult Index() { - ViewBag.Title = "Privacy Policy - " + _config.Title; + ViewBag.Title = "Privacy Policy"; ViewBag.Description = "Teknik privacy policy."; return View(new PrivacyViewModel()); diff --git a/Teknik/Areas/Shortener/Controllers/ShortenerController.cs b/Teknik/Areas/Shortener/Controllers/ShortenerController.cs index 0234112..816a249 100644 --- a/Teknik/Areas/Shortener/Controllers/ShortenerController.cs +++ b/Teknik/Areas/Shortener/Controllers/ShortenerController.cs @@ -26,7 +26,7 @@ namespace Teknik.Areas.Shortener.Controllers [AllowAnonymous] public IActionResult Index() { - ViewBag.Title = "Url Shortener - " + _config.Title; + ViewBag.Title = "Url Shortener"; ShortenViewModel model = new ShortenViewModel(); return View(model); } @@ -97,7 +97,7 @@ namespace Teknik.Areas.Shortener.Controllers [AllowAnonymous] public IActionResult Verify() { - ViewBag.Title = "Url Shortener Verification - " + _config.Title; + ViewBag.Title = "Url Shortener Verification"; return View(); } } diff --git a/Teknik/Areas/Stats/Controllers/StatsController.cs b/Teknik/Areas/Stats/Controllers/StatsController.cs index 50a6e21..24ea056 100644 --- a/Teknik/Areas/Stats/Controllers/StatsController.cs +++ b/Teknik/Areas/Stats/Controllers/StatsController.cs @@ -26,7 +26,7 @@ namespace Teknik.Areas.Stats.Controllers [AllowAnonymous] public IActionResult Index() { - ViewBag.Title = "System Statistics - " + _config.Title; + ViewBag.Title = "System Statistics"; ViewBag.Description = "Current statistics for the services."; StatsViewModel model = new StatsViewModel(); diff --git a/Teknik/Areas/TOS/Controllers/TOSController.cs b/Teknik/Areas/TOS/Controllers/TOSController.cs index 0f25546..7dafdee 100644 --- a/Teknik/Areas/TOS/Controllers/TOSController.cs +++ b/Teknik/Areas/TOS/Controllers/TOSController.cs @@ -20,7 +20,7 @@ namespace Teknik.Areas.TOS.Controllers [AllowAnonymous] public IActionResult Index() { - ViewBag.Title = "Terms of Service - " + _config.Title; + ViewBag.Title = "Terms of Service"; ViewBag.Description = "Teknik Terms of Service."; return View(new TOSViewModel()); diff --git a/Teknik/Areas/Upload/Controllers/UploadController.cs b/Teknik/Areas/Upload/Controllers/UploadController.cs index 26c5417..c601484 100644 --- a/Teknik/Areas/Upload/Controllers/UploadController.cs +++ b/Teknik/Areas/Upload/Controllers/UploadController.cs @@ -35,7 +35,7 @@ namespace Teknik.Areas.Upload.Controllers [AllowAnonymous] public IActionResult Index() { - ViewBag.Title = "Teknik Upload - End to End Encryption"; + ViewBag.Title = "Upload Files"; UploadViewModel model = new UploadViewModel(); model.CurrentSub = Subdomain; Users.Models.User user = UserHelper.GetUser(_dbContext, User.Identity.Name); @@ -175,7 +175,7 @@ namespace Teknik.Areas.Upload.Controllers { if (_config.UploadConfig.DownloadEnabled) { - ViewBag.Title = "Teknik Download - " + file; + ViewBag.Title = "Download " + file; string fileName = string.Empty; string url = string.Empty; string key = string.Empty; @@ -462,7 +462,7 @@ namespace Teknik.Areas.Upload.Controllers [AllowAnonymous] public IActionResult DeleteByKey(string file, string key) { - ViewBag.Title = "File Delete - " + file + " - " + _config.Title; + ViewBag.Title = "File Delete | " + file ; Models.Upload upload = _dbContext.Uploads.Where(up => up.Url == file).FirstOrDefault(); if (upload != null) { diff --git a/Teknik/Areas/User/Controllers/UserController.cs b/Teknik/Areas/User/Controllers/UserController.cs index c4e5346..c358780 100644 --- a/Teknik/Areas/User/Controllers/UserController.cs +++ b/Teknik/Areas/User/Controllers/UserController.cs @@ -96,7 +96,7 @@ namespace Teknik.Areas.Users.Controllers [AllowAnonymous] public IActionResult GetPremium() { - ViewBag.Title = "Get a Premium Account - " + _config.Title; + ViewBag.Title = "Get a Premium Account"; GetPremiumViewModel model = new GetPremiumViewModel(); @@ -193,7 +193,7 @@ namespace Teknik.Areas.Users.Controllers } ProfileViewModel model = new ProfileViewModel(); - ViewBag.Title = "User Does Not Exist - " + _config.Title; + ViewBag.Title = "User Does Not Exist"; ViewBag.Description = "The User does not exist"; try @@ -202,7 +202,7 @@ namespace Teknik.Areas.Users.Controllers if (user != null) { - ViewBag.Title = username + "'s Profile - " + _config.Title; + ViewBag.Title = username + "'s Profile"; ViewBag.Description = "Viewing " + username + "'s Profile"; model.UserID = user.UserId; @@ -247,7 +247,7 @@ namespace Teknik.Areas.Users.Controllers string username = User.Identity.Name; ViewServiceDataViewModel model = new ViewServiceDataViewModel(); - ViewBag.Title = "User Does Not Exist - " + _config.Title; + ViewBag.Title = "User Does Not Exist"; ViewBag.Description = "The User does not exist"; try @@ -256,7 +256,7 @@ namespace Teknik.Areas.Users.Controllers if (user != null) { - ViewBag.Title = "Service Data - " + _config.Title; + ViewBag.Title = "Service Data"; ViewBag.Description = "Viewing all of your service data"; model.Uploads = _dbContext.Uploads.Where(u => u.UserId == user.UserId).OrderByDescending(u => u.DateUploaded).ToList(); @@ -292,7 +292,7 @@ namespace Teknik.Areas.Users.Controllers if (user != null) { - ViewBag.Title = "Profile Settings - " + _config.Title; + ViewBag.Title = "Profile Settings"; ViewBag.Description = "Your " + _config.Title + " Profile Settings"; ProfileSettingsViewModel model = new ProfileSettingsViewModel(); @@ -316,7 +316,7 @@ namespace Teknik.Areas.Users.Controllers if (user != null) { - ViewBag.Title = "Account Settings - " + _config.Title; + ViewBag.Title = "Account Settings"; ViewBag.Description = "Your " + _config.Title + " Account Settings"; AccountSettingsViewModel model = new AccountSettingsViewModel(); @@ -337,7 +337,7 @@ namespace Teknik.Areas.Users.Controllers if (user != null) { - ViewBag.Title = "Security Settings - " + _config.Title; + ViewBag.Title = "Security Settings"; ViewBag.Description = "Your " + _config.Title + " Security Settings"; SecuritySettingsViewModel model = new SecuritySettingsViewModel(); @@ -379,7 +379,7 @@ namespace Teknik.Areas.Users.Controllers if (user != null) { - ViewBag.Title = "Developer Settings - " + _config.Title; + ViewBag.Title = "Developer Settings"; ViewBag.Description = "Your " + _config.Title + " Developer Settings"; DeveloperSettingsViewModel model = new DeveloperSettingsViewModel(); @@ -426,7 +426,7 @@ namespace Teknik.Areas.Users.Controllers if (user != null) { - ViewBag.Title = "Invite Settings - " + _config.Title; + ViewBag.Title = "Invite Settings"; ViewBag.Description = "Your " + _config.Title + " Invite Settings"; InviteSettingsViewModel model = new InviteSettingsViewModel(); @@ -471,7 +471,7 @@ namespace Teknik.Areas.Users.Controllers if (user != null) { - ViewBag.Title = "Blog Settings - " + _config.Title; + ViewBag.Title = "Blog Settings"; ViewBag.Description = "Your " + _config.Title + " Blog Settings"; BlogSettingsViewModel model = new BlogSettingsViewModel(); @@ -494,7 +494,7 @@ namespace Teknik.Areas.Users.Controllers if (user != null) { - ViewBag.Title = "Upload Settings - " + _config.Title; + ViewBag.Title = "Upload Settings"; ViewBag.Description = "Your " + _config.Title + " Upload Settings"; UploadSettingsViewModel model = new UploadSettingsViewModel(); @@ -515,7 +515,7 @@ namespace Teknik.Areas.Users.Controllers [AllowAnonymous] public async Task ViewRawPGP(string username) { - ViewBag.Title = username + "'s Public Key - " + _config.Title; + ViewBag.Title = username + "'s Public Key"; ViewBag.Description = "The PGP public key for " + username; IdentityUserInfo userClaims = await IdentityHelper.GetIdentityUserInfo(_config, username); diff --git a/Teknik/Areas/Vault/Controllers/VaultController.cs b/Teknik/Areas/Vault/Controllers/VaultController.cs index c2d3a4b..05dca0e 100644 --- a/Teknik/Areas/Vault/Controllers/VaultController.cs +++ b/Teknik/Areas/Vault/Controllers/VaultController.cs @@ -44,7 +44,7 @@ namespace Teknik.Areas.Vault.Controllers _dbContext.Entry(foundVault).State = EntityState.Modified; _dbContext.SaveChanges(); - ViewBag.Title = foundVault.Title + " - Teknik Vault"; + ViewBag.Title = foundVault.Title + " | Vault"; VaultViewModel model = new VaultViewModel(); model.CurrentSub = Subdomain; @@ -189,7 +189,7 @@ namespace Teknik.Areas.Vault.Controllers { if (foundVault.User.Username == User.Identity.Name) { - ViewBag.Title = "Edit Vault - " + foundVault.Title; + ViewBag.Title = "Edit Vault | " + foundVault.Title; ModifyVaultViewModel model = new ModifyVaultViewModel(); model.CurrentSub = Subdomain; diff --git a/Teknik/Controllers/DefaultController.cs b/Teknik/Controllers/DefaultController.cs index b6e4677..8052f7e 100644 --- a/Teknik/Controllers/DefaultController.cs +++ b/Teknik/Controllers/DefaultController.cs @@ -43,7 +43,7 @@ namespace Teknik.Controllers _config = config; _dbContext = dbContext; - ViewBag.Title = _config.Title; + ViewBag.Title = string.Empty; ViewBag.Description = _config.Description; } diff --git a/Teknik/Views/Shared/_Layout.cshtml b/Teknik/Views/Shared/_Layout.cshtml index 79d0301..3706ca2 100644 --- a/Teknik/Views/Shared/_Layout.cshtml +++ b/Teknik/Views/Shared/_Layout.cshtml @@ -26,7 +26,16 @@ - @ViewBag.Title + + @if (string.IsNullOrEmpty(ViewBag.Title)) + { + <text>@Config.Title</text> + } + else + { + <text>@ViewBag.Title | @Config.Title</text> + } +