Skip to content

Commit

Permalink
- show the baseline goal without quotes and bold but with parentheses…
Browse files Browse the repository at this point in the history
…, like before goals were implemented

- put baseline goal show as the first tab on game pages, and add link to goals list
- make goal list back button actually go back
- turn goal list into bullet list
- make goal edit buttons small
- rename goal list catalog button from "new" to "manage"

- select game after it was created for cataloging
  • Loading branch information
vadosnaprimer committed Jan 24, 2024
1 parent 7c932bb commit 256b8c0
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 26 deletions.
7 changes: 5 additions & 2 deletions TASVideos/Pages/Games/Edit.cshtml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System;
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using TASVideos.Core.Services.ExternalMediaPublisher;
Expand Down Expand Up @@ -164,7 +165,9 @@ await _publisher.SendGameManagement(
}
}

return BasePageRedirect("Index", new { game.Id });
return string.IsNullOrWhiteSpace(HttpContext.Request.ReturnUrl())
? BasePageRedirect("Index", new { game.Id })
: BaseReturnUrlRedirect($"?GameId={game.Id}");
}

private static void SetGameValues(Game game, GameEditModel editModel)
Expand Down
36 changes: 22 additions & 14 deletions TASVideos/Pages/Games/Goals/List.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}

<h4>Game: <a asp-page="/Games/Index" asp-route-id="@Model.GameId">@Model.GameDisplayName</a>
<a condition="!string.IsNullOrWhiteSpace(returnUrl)" asp-page="/Goals/Index" class="btn btn-secondary mb-2 float-end"><span class="fa fa-arrow-left"></span> Back</a>
<a condition="!string.IsNullOrWhiteSpace(returnUrl)" href="@returnUrl" class="btn btn-secondary mb-2 float-end"><span class="fa fa-arrow-left"></span> Back</a>
</h4>
<table class="table table-bordered table-striped">
<tr>
Expand All @@ -33,24 +33,32 @@
<td condition="@(goal.Id != Model.GoalToEdit || goal.DisplayName == "baseline")">
@goal.DisplayName</td>
<td>
@foreach (var pub in goal.Publications.OrderBy(p => p.Obs).ThenByDescending(p => p.Id))
{
<small condition="pub.Obs">(Obsolete)</small>
<pub-link id="@pub.Id">
@pub.Title
</pub-link><br />
}
<ul>
@foreach (var pub in goal.Publications.OrderBy(p => p.Obs).ThenByDescending(p => p.Id))
{
<li>
<small condition="pub.Obs">(Obsolete)</small>
<pub-link id="@pub.Id">
[@pub.Id] @pub.Title
</pub-link>
</li>
}
</ul>
</td>
<td>
@foreach (var sub in goal.Submissions.OrderByDescending(s => s.Id))
{
<sub-link id="@sub.Id">@sub.Title</sub-link><br />
}
<ul>
@foreach (var sub in goal.Submissions.OrderByDescending(s => s.Id))
{
<li>
<sub-link id="@sub.Id">@sub.Title</sub-link>
</li>
}
</ul>
</td>
<td>
<div class="btn-toolbar">
<a asp-page="List" asp-route-goalToEdit="@goal.Id" permission="CatalogMovies" condition="@(goal.Id != Model.GoalToEdit && goal.DisplayName != "baseline")" asp-route-gameId="@Model.GameId" class="btn btn-primary"><i class="fa fa-pencil"></i> Edit</a>
<a condition="canDelete" asp-page-handler="Delete" asp-route-gameGroupId="@goal.Id" class="btn btn-danger"><i class="fa fa-remove"></i></a>
<a asp-page="List" asp-route-goalToEdit="@goal.Id" permission="CatalogMovies" condition="@(goal.Id != Model.GoalToEdit && goal.DisplayName != "baseline")" asp-route-gameId="@Model.GameId" class="btn btn-sm btn-primary"><i class="fa fa-pencil"></i> Edit</a>
<a condition="canDelete" asp-page-handler="Delete" asp-route-gameGroupId="@goal.Id" class="btn btn-sm btn-danger"><i class="fa fa-remove"></i> Delete</a>
</div>
</td>
</tr>
Expand Down
13 changes: 9 additions & 4 deletions TASVideos/Pages/Games/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,6 @@
</a>)
</span>
</li>
<li condition="Model.Game.PublicationCount > 0">
<a asp-page="PublicationHistory" asp-route-id="@Model.Game.Id">Publication History</a>
</li>
<li>
<a href="/Subs-List?GameId=@(Model.Game.Id)">
@Model.Game.SubmissionCount Submissions
Expand All @@ -137,7 +134,15 @@
<a href="/UserFiles/Game/@(Model.Game.Id)">
@Model.Game.UserFilesCount User Files
</a>
</li>
</li>
<li condition="Model.Game.PublicationCount > 0">
<a asp-page="PublicationHistory" asp-route-id="@Model.Game.Id">Publication History</a>
</li>
<li>
<a href="/Games/@(Model.Game.Id)/Goals/List">
Goals
</a>
</li>
</ul>
</column>
<column md="6" condition="Model.WatchFiles.Any()">
Expand Down
12 changes: 9 additions & 3 deletions TASVideos/Pages/Games/Index.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public async Task<IActionResult> OnGet()
Game = game;
var movies = await _db.Publications
.Where(p => p.GameId == Game.Id && p.ObsoletedById == null)
.OrderBy(p => p.GameGoal!.DisplayName.Length)
.OrderBy(p => p.GameGoal!.DisplayName == "baseline" ? -1 : p.GameGoal!.DisplayName.Length)
.ThenBy(p => p.Frames)
.Select(p => new
{
Expand All @@ -75,8 +75,14 @@ public async Task<IActionResult> OnGet()

Movies = movies
.Select(m => new TabMiniMovieModel(
movies.Count(mm => mm.Goal == m.Goal) > 1 ? m.GameTitle : "",
m.Goal,
movies.Count(mm => mm.Goal == m.Goal) > 1
? m.GameTitle
: m.Goal == "baseline"
? "(baseline)"
: "",
m.Goal == "baseline"
? ""
: m.Goal,
new MiniMovieModel
{
Id = m.Id,
Expand Down
2 changes: 1 addition & 1 deletion TASVideos/Pages/Games/Versions/Edit.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public async Task<IActionResult> OnPost()

return string.IsNullOrWhiteSpace(HttpContext.Request.ReturnUrl())
? RedirectToPage("List", new { gameId = GameId })
: BaseReturnUrlRedirect($"?GameId={GameId}&GameVersionId={version.Id}");
: BaseReturnUrlRedirect($"&GameVersionId={version.Id}");
}

public async Task<IActionResult> OnPostDelete()
Expand Down
2 changes: 1 addition & 1 deletion TASVideos/Pages/Publications/Catalog.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<span asp-validation-for="Catalog.GameGoalId" class="text-danger"></span>
</div>
<div class="col-2">
<button id="create-goal" type="button" class="btn btn-primary">New</button>
<button id="create-goal" type="button" class="btn btn-primary">Manage</button>
</div>
</row>
</fieldset>
Expand Down
2 changes: 1 addition & 1 deletion TASVideos/Pages/Submissions/Catalog.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<span asp-validation-for="Catalog.GameGoalId" class="text-danger"></span>
</div>
<div class="col-2">
<button id="create-goal" type="button" class="btn btn-primary">New</button>
<button id="create-goal" type="button" class="btn btn-primary">Manage</button>
</div>
</row>
</fieldset>
Expand Down

0 comments on commit 256b8c0

Please sign in to comment.