Skip to content

Commit

Permalink
this part is good (#1751)
Browse files Browse the repository at this point in the history
  • Loading branch information
vadosnaprimer authored Jan 24, 2024
1 parent 1c8034d commit 828407a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 23 deletions.
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/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 828407a

Please sign in to comment.