Skip to content

Commit

Permalink
Don't hardcode classes
Browse files Browse the repository at this point in the history
  • Loading branch information
YoshiRulz committed Sep 23, 2024
1 parent f1a3b1d commit 9a369ce
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 4 additions & 3 deletions TASVideos/WikiModules/PublicationsByPlatform.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
<tr>
<td>@platform.DisplayName</td>
<td><a href="/[email protected]">All Publications</a></td>
<td><a href="/[email protected]">Standard</a></td>
<td><a href="/[email protected]">Stars</a></td>
<td><a href="/[email protected]">Alternative</a></td>
@foreach (var pubClass in Model.PubClasses.OrderBy(t => t.Id))
{
<td><a href="/[email protected]@pubClass.Link">@pubClass.Name</a></td>
}
</tr>
}
</table>
5 changes: 4 additions & 1 deletion TASVideos/WikiModules/PublicationsByPlatform.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@
namespace TASVideos.WikiModules;

[WikiModule(ModuleNames.PublicationsByPlatform)]
public class PublicationsByPlatform(IGameSystemService platforms) : WikiViewComponent
public class PublicationsByPlatform(IGameSystemService platforms, IClassService classes) : WikiViewComponent
{
public IReadOnlyList<(string DisplayName, string Code)> Platforms { get; private set; } = null!;

public IReadOnlyCollection<PublicationClass> PubClasses { get; set; } = null!;

public async Task<IViewComponentResult> InvokeAsync(IList<string> groupings)
{
var extant = (await platforms.GetAll()).ToList();
Expand Down Expand Up @@ -42,6 +44,7 @@ void ProcessGroup(string groupStr)
)))
.OrderBy(static tuple => tuple.DisplayName)
.ToArray();
PubClasses = await classes.GetAll();
return View();
}
}

0 comments on commit 9a369ce

Please sign in to comment.