Skip to content

Commit

Permalink
add differently colored favicons, green for pubs, red for subs (#2036)
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterjun3 authored Nov 11, 2024
1 parent 0eb93c6 commit 768cf39
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions TASVideos/Extensions/ViewDataDictionaryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ public static MetaTag GetMetaTags(this ViewDataDictionary viewData)
public static void SetTitle(this ViewDataDictionary viewData, string title)
=> viewData["Title"] = title;

public static string GetFavicon(this ViewDataDictionary viewData) => viewData["Favicon"]?.ToString() ?? "favicon.ico";

public static void UseGreenFavicon(this ViewDataDictionary viewData)
=> viewData["Favicon"] = "favicon_green.ico";

public static void UseRedFavicon(this ViewDataDictionary viewData)
=> viewData["Favicon"] = "favicon_red.ico";

public static void SetHeading(this ViewDataDictionary viewData, string heading)
=> viewData["Heading"] = heading;

Expand Down
1 change: 1 addition & 0 deletions TASVideos/Pages/Publications/View.cshtml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
@page "{id}"
@model ViewModel
@{
ViewData.UseGreenFavicon();
ViewData.IgnorePageTitle();
ViewData.SetTitle($"{Model.Publication.Title} - Movie #{Model.Id}");
ViewData.SetMetaTags(new MetaTag
Expand Down
2 changes: 1 addition & 1 deletion TASVideos/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@{ var title = ViewData.GetTitle(); }
<title>@(title is not null ? title + " - " : "")TASVideos</title>

<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="/@(ViewData.GetFavicon())" type="image/x-icon">
<link rel="stylesheet" href="/css/bootstrap.css" />
<link rel="stylesheet" href="/css/site.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.6.0/css/all.min.css"
Expand Down
1 change: 1 addition & 0 deletions TASVideos/Pages/Submissions/View.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@inject IQueueService QueueService
@model ViewModel
@{
ViewData.UseRedFavicon();
ViewData.SetTitle($"{Model.Submission.Title} - Submission #{Model.Id}");
ViewData.SetHeading($"Submission {Model.Submission.Title}");
ViewData.SetNavigation(Model.Id, "/{0}S");
Expand Down
Binary file added TASVideos/wwwroot/favicon_green.ico
Binary file not shown.
Binary file added TASVideos/wwwroot/favicon_red.ico
Binary file not shown.

0 comments on commit 768cf39

Please sign in to comment.