Feature: Hall of Fame Module Implementation (1.0.1)

- Added Hall of Fame module logic (Models, Controller, Service).
- Implemented 'One Entry Per User' and 'Publish/Draft' workflow.
- Updated UI to Grid Layout (Index.razor) and Unified Form (Edit.razor).
- Added Database Migration 01000001 for new columns.
- Bumped version to 1.0.1.
This commit is contained in:
Adam Gaiswinkler
2026-01-15 00:01:55 +01:00
parent 5dfa690432
commit 7114904412
12 changed files with 378 additions and 55 deletions

View File

@@ -13,27 +13,55 @@
}
else
{
<ActionLink Action="Add" Security="SecurityAccessLevel.Edit" Text="Add HallOfFame" ResourceKey="Add" />
<br />
<br />
<div class="row mb-4">
<div class="col text-end">
@if (PageState.User != null)
{
if (_myEntry != null)
{
<ActionLink Action="Edit" Parameters="@($"id=" + _myEntry.HallOfFameId.ToString())" Text="Hall-of-Fame-Eintrag bearbeiten" />
}
else
{
<ActionLink Action="Add" Text="Neuen Hall-of-Fame-Eintrag erstellen" />
}
}
else
{
<p class="text-muted">Einloggen, um einen Eintrag zu erstellen.</p>
}
</div>
</div>
@if (@_HallOfFames.Count != 0)
{
<Pager Items="@_HallOfFames">
<Header>
<th style="width: 1px;">&nbsp;</th>
<th style="width: 1px;">&nbsp;</th>
<th>@Localizer["Name"]</th>
</Header>
<Row>
<td><ActionLink Action="Edit" Parameters="@($"id=" + context.HallOfFameId.ToString())" ResourceKey="Edit" /></td>
<td><ActionDialog Header="Delete HallOfFame" Message="Are You Sure You Wish To Delete This HallOfFame?" Action="Delete" Security="SecurityAccessLevel.Edit" Class="btn btn-danger" OnClick="@(async () => await Delete(context))" ResourceKey="Delete" Id="@context.HallOfFameId.ToString()" /></td>
<td>@context.Name</td>
</Row>
</Pager>
<div class="row">
@foreach (var item in _HallOfFames)
{
<div class="col-md-4 mb-3">
<div class="card h-100">
@if (!string.IsNullOrEmpty(item.Image))
{
<img src="@item.Image" class="card-img-top" alt="@item.Name" style="max-height: 200px; object-fit: cover;">
}
<div class="card-body">
<h5 class="card-title">@item.Name (@item.Year)</h5>
<p class="card-text">@item.Description</p>
@if (!string.IsNullOrEmpty(item.Link))
{
<a href="@item.Link" target="_blank" class="btn btn-sm btn-outline-primary">Mehr Infos</a>
}
</div>
</div>
</div>
}
</div>
}
else
{
<p>@Localizer["Message.DisplayNone"]</p>
<div class="alert alert-info">
Es sind noch keine Hall-of-Fame-Einträge veröffentlicht.
</div>
}
}
@@ -47,12 +75,18 @@ else
};
List<HallOfFame> _HallOfFames;
HallOfFame _myEntry;
protected override async Task OnInitializedAsync()
{
try
{
_HallOfFames = await HallOfFameService.GetHallOfFamesAsync(ModuleState.ModuleId);
if (PageState.User != null)
{
_myEntry = await HallOfFameService.GetHallOfFameByUserIdAsync(PageState.User.UserId, ModuleState.ModuleId);
}
}
catch (Exception ex)
{
@@ -60,20 +94,4 @@ else
AddModuleMessage(Localizer["Message.LoadError"], MessageType.Error);
}
}
private async Task Delete(HallOfFame HallOfFame)
{
try
{
await HallOfFameService.DeleteHallOfFameAsync(HallOfFame.HallOfFameId, ModuleState.ModuleId);
await logger.LogInformation("HallOfFame Deleted {HallOfFame}", HallOfFame);
_HallOfFames = await HallOfFameService.GetHallOfFamesAsync(ModuleState.ModuleId);
StateHasChanged();
}
catch (Exception ex)
{
await logger.LogError(ex, "Error Deleting HallOfFame {HallOfFame} {Error}", HallOfFame, ex.Message);
AddModuleMessage(Localizer["Message.DeleteError"], MessageType.Error);
}
}
}