- 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.
97 lines
3.1 KiB
Plaintext
97 lines
3.1 KiB
Plaintext
@using SZUAbsolventenverein.Module.HallOfFame.Services
|
|
@using SZUAbsolventenverein.Module.HallOfFame.Models
|
|
|
|
@namespace SZUAbsolventenverein.Module.HallOfFame
|
|
@inherits ModuleBase
|
|
@inject IHallOfFameService HallOfFameService
|
|
@inject NavigationManager NavigationManager
|
|
@inject IStringLocalizer<Index> Localizer
|
|
|
|
@if (_HallOfFames == null)
|
|
{
|
|
<p><em>Loading...</em></p>
|
|
}
|
|
else
|
|
{
|
|
<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)
|
|
{
|
|
<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
|
|
{
|
|
<div class="alert alert-info">
|
|
Es sind noch keine Hall-of-Fame-Einträge veröffentlicht.
|
|
</div>
|
|
}
|
|
}
|
|
|
|
@code {
|
|
public override string RenderMode => RenderModes.Static;
|
|
|
|
public override List<Resource> Resources => new List<Resource>()
|
|
{
|
|
new Stylesheet("_content/SZUAbsolventenverein.Module.HallOfFame/Module.css"),
|
|
new Script("_content/SZUAbsolventenverein.Module.HallOfFame/Module.js")
|
|
};
|
|
|
|
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)
|
|
{
|
|
await logger.LogError(ex, "Error Loading HallOfFame {Error}", ex.Message);
|
|
AddModuleMessage(Localizer["Message.LoadError"], MessageType.Error);
|
|
}
|
|
}
|
|
} |