Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

order award categories in the award editor (by description) #1754

Merged
merged 3 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions TASVideos/Pages/AwardsEditor/Assign.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public async Task<IActionResult> OnPostRevoke(string shortName)
private async Task Initialize()
{
AvailableAwardCategories = UiDefaults.DefaultEntry.Concat(await _awards.AwardCategories()
.OrderBy(c => c.Description)
.ToDropdown(Year)
.ToListAsync())
.ToList();
Expand Down
26 changes: 13 additions & 13 deletions TASVideos/Pages/AwardsEditor/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,19 @@
<a asp-page="ListCategories" class="btn btn-primary float-end" asp-route-returnUrl="@HttpContext.CurrentPathToReturnUrl()">List Award Categories</a>
</h4>

<br/>
<hr />
<row>
<column md="6">
<h4>Upload an Award Image</h4>
<a asp-page="UploadImage" asp-route-year="@Model.Year" asp-route-returnUrl="@HttpContext.CurrentPathToReturnUrl()" class="btn btn-primary"><i class="fa fa-upload"></i> Upload</a>
</column>
<column md="6">
<h4>Assign An Award</h4>
<a class="btn btn-primary" asp-page="Assign" asp-route-year="@Model.Year" asp-route-returnUrl="@HttpContext.CurrentPathToReturnUrl()"><i class="fa fa-plus"></i> Assign</a>
</column>
</row>

<hr />
<h4>Current Awards</h4>
<table class="table">
<tr>
Expand Down Expand Up @@ -82,15 +94,3 @@
}
</table>

<hr />
<row>
<column md="6">
<h4>Assign An Award</h4>
<a class="btn btn-primary" asp-page="Assign" asp-route-year="@Model.Year" asp-route-returnUrl="@HttpContext.CurrentPathToReturnUrl()"><i class="fa fa-plus"></i> Assign</a>
</column>
<column md="6">
<h4>Upload an Award Image</h4>
<a asp-page="UploadImage" asp-route-year="@Model.Year" asp-route-returnUrl="@HttpContext.CurrentPathToReturnUrl()" class="btn btn-primary"><i class="fa fa-upload"></i> Upload</a>
</column>
</row>

6 changes: 3 additions & 3 deletions TASVideos/Pages/AwardsEditor/ListCategories.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,25 @@
<a asp-page="Index" asp-route-year="@DateTime.UtcNow.Year" class="btn btn-primary float-end">Awards Editor</a>
<table class="table table-sm table-striped">
<tr>
<th>Description</th>
<th>Base Icon</th>
<th>Type</th>
<th>Short Name</th>
<th>Description</th>
<th>In Use</th>
</tr>
@foreach (var cat in Model.Categories.OrderBy(c => c.Type).ThenBy(c => c.ShortName))
{
<tr>
<td>@cat.Description</td>
<td>
<img style="max-height: 48px;"
srcset="/awards/@(cat.ShortName)_xxxx.png .5x,
/awards/@(cat.ShortName)_xxxx-2x.png 1x,
/awards/@(cat.ShortName)_xxxx-4x.png 2x"
src="/awards/@(cat.ShortName)-2x.png" alt="@cat.Description" loading="lazy" />
src="/awards/@(cat.ShortName)-2x.png" alt="N/A" loading="lazy" />
</td>
<td>@cat.Type</td>
<td>@cat.ShortName</td>
<td>@cat.Description</td>
<td>
<i class="fa fa-check text-success" condition="cat.InUse"></i>
@cat.InUse
Expand Down
1 change: 1 addition & 0 deletions TASVideos/Pages/AwardsEditor/ListCategories.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ public async Task<IActionResult> OnGet()
InUse = _db.PublicationAwards.Any(pa => pa.AwardId == a.Id)
|| _db.UserAwards.Any(ua => ua.AwardId == a.Id)
})
.OrderBy(c => c.Description)
.ToListAsync();
return Page();
}
Expand Down
5 changes: 3 additions & 2 deletions TASVideos/Pages/AwardsEditor/UploadImage.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ await _mediaFileUploader.UploadAwardImage(
private async Task Initialize()
{
AvailableAwardCategories = UiDefaults.DefaultEntry.Concat(await _awards.AwardCategories()
.ToDropdown(Year)
.ToListAsync())
.OrderBy(c => c.Description)
.ToDropdown(Year)
.ToListAsync())
.ToList();
}
}
Loading