Skip to content

Commit

Permalink
Revert "Add prev/next ID buttons for game groups (#2000)"
Browse files Browse the repository at this point in the history
This reverts commit e079b4a.
  • Loading branch information
adelikat committed Oct 1, 2024
1 parent 78c9e1f commit 34e13d2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 11 deletions.
4 changes: 2 additions & 2 deletions TASVideos/Extensions/ViewDataDictionaryExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ public static string GetHeading(this ViewDataDictionary viewData)
public static void SetWikiPage(this ViewDataDictionary viewData, IWikiPage wikiPage)
=> viewData["WikiPage"] = wikiPage;

public static void SetNavigation(this ViewDataDictionary viewData, int id, string fmtStr = "{0}")
public static void SetNavigation(this ViewDataDictionary viewData, int id, string suffix)
{
viewData["NavigationId"] = id;
viewData["NavigationFmtStr"] = fmtStr;
viewData["NavigationSuffix"] = suffix;
}

public static string ActivePageClass(this ViewDataDictionary viewData, string page)
Expand Down
4 changes: 0 additions & 4 deletions TASVideos/Pages/GameGroups/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
@model IndexModel
@{
ViewData.SetTitle($"Games for Group: {Model.Name}");
if (int.TryParse(Model.Id, out var id))
{
ViewData.SetNavigation(id, "/GameGroups/{0}");
}
}

<warning-alert condition="!Model.Games.Any()">
Expand Down
2 changes: 1 addition & 1 deletion TASVideos/Pages/Games/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

if (int.TryParse(Model.Id, out int id))
{
ViewData.SetNavigation(id, "/{0}G");
ViewData.SetNavigation(id, "G");
}
}

Expand Down
5 changes: 2 additions & 3 deletions TASVideos/Pages/Shared/_Layout.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
var heading = ViewData.GetHeading();
int? prev = null;
int? next = null;
string? fmtStr = ViewData["NavigationFmtStr"] as string;
if (User.Has(PermissionTo.CatalogMovies))
{
var id = ViewData.Int("NavigationId");
Expand All @@ -102,7 +101,7 @@

<div class="container mb-2">
<h1 class="page-title card card-body d-block">
<a condition="prev.HasValue" href="@string.Format(fmtStr!, prev)"><i class="fa fa-arrow-left"></i></a>
<a condition="prev.HasValue" href="@(prev + ViewData["NavigationSuffix"]?.ToString())"><i class="fa fa-arrow-left"></i></a>
@if (IsSectionDefined("PageTitle"))
{
@await RenderSectionAsync("PageTitle")
Expand All @@ -111,7 +110,7 @@
{
@heading
}
<a condition="next.HasValue" class="float-end" href="@string.Format(fmtStr!, next)"><i class="fa fa-arrow-right"></i></a>
<a condition="next.HasValue" class="float-end" href="@(next + ViewData["NavigationSuffix"]?.ToString())"><i class="fa fa-arrow-right"></i></a>
</h1>
</div>
}
Expand Down
2 changes: 1 addition & 1 deletion TASVideos/Pages/Submissions/View.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
@{
ViewData.SetTitle($"{Model.Submission.Title} - Submission #{Model.Id}");
ViewData.SetHeading($"Submission {Model.Submission.Title}");
ViewData.SetNavigation(Model.Id, "/{0}S");
ViewData.SetNavigation(Model.Id, "S");
bool hasEncode = !string.IsNullOrWhiteSpace(Model.Submission.EncodeEmbedLink);
bool canEdit = User.Has(PermissionTo.EditSubmissions)
|| (Model.CanEdit && User.Has(PermissionTo.SubmitMovies));
Expand Down

0 comments on commit 34e13d2

Please sign in to comment.