2023-08-04 17:05:25 +02:00
|
|
|
@page "/gallery"
|
|
|
|
|
2023-10-10 18:56:05 +02:00
|
|
|
@using DataAccess.Data
|
|
|
|
@using DataAccess.Models
|
|
|
|
|
|
|
|
@inject BildInfoData BildInfoData;
|
|
|
|
@inject WunschInfoData WunschInfoData;
|
|
|
|
|
2023-08-04 17:05:25 +02:00
|
|
|
<style>
|
|
|
|
.image-grid {
|
|
|
|
background-color: white; /* Hintergrund der RadzenDataList weiß machen */
|
|
|
|
}
|
|
|
|
|
|
|
|
.rz-data-list {
|
|
|
|
display: flex;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
justify-content: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.image-grid-item {
|
|
|
|
margin: 5px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.image-popup {
|
|
|
|
display: none;
|
|
|
|
position: fixed;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
|
|
|
background-color: rgba(255, 255, 255, 0.9); /* Weißer Hintergrund mit Transparenz */
|
|
|
|
z-index: 9999;
|
|
|
|
}
|
|
|
|
|
|
|
|
.image-popup-content {
|
|
|
|
display: flex;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: space-between;
|
|
|
|
max-width: 800px;
|
|
|
|
max-height: 400px;
|
|
|
|
position: absolute;
|
|
|
|
top: 50%;
|
|
|
|
left: 50%;
|
|
|
|
transform: translate(-50%, -50%);
|
|
|
|
padding: 20px;
|
|
|
|
border-radius: 5px;
|
|
|
|
background-color: white; /* Weißer Hintergrund für den Inhalt */
|
|
|
|
}
|
|
|
|
|
|
|
|
.image-info {
|
|
|
|
flex: 1;
|
|
|
|
display: flex;
|
|
|
|
flex-direction: column;
|
|
|
|
align-items: center;
|
|
|
|
}
|
|
|
|
|
|
|
|
.close-button {
|
|
|
|
flex: 0 0 auto;
|
|
|
|
display: flex;
|
|
|
|
align-items: flex-start;
|
|
|
|
justify-content: flex-end;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|
2023-08-18 14:57:12 +02:00
|
|
|
<div>
|
2023-10-10 18:56:05 +02:00
|
|
|
<RadzenDataList WrapItems="@true" AllowPaging="true" Data="@_bildInfos" PageSize="20" PagerHorizontalAlign="HorizontalAlign.Left" ShowPagingSummary="true" class="image-grid">
|
|
|
|
<Template Context="bildInfo">
|
2023-08-18 14:57:12 +02:00
|
|
|
<div class="image-grid-item">
|
|
|
|
<RadzenCard Style="width: 200px; height: 200px; padding: 0; border: none;">
|
2023-10-10 18:56:05 +02:00
|
|
|
<RadzenButton Click="@(args => ShowImageInfo(bildInfo))">
|
|
|
|
<RadzenImage Src="@bildInfo.Dateiname" Style="width: 100%; height: 100%; object-fit: cover;" />
|
2023-08-18 14:57:12 +02:00
|
|
|
</RadzenButton>
|
|
|
|
</RadzenCard>
|
|
|
|
</div>
|
|
|
|
</Template>
|
|
|
|
</RadzenDataList>
|
|
|
|
|
|
|
|
<div class="image-popup" style="@popupStyle">
|
|
|
|
<div class="image-popup-content">
|
|
|
|
<div class="image-info">
|
|
|
|
<RadzenImage Src="@selectedImage" Style="max-width: 100%; max-height: 300px; object-fit: contain;" />
|
|
|
|
<p>@infoText</p>
|
|
|
|
</div>
|
|
|
|
<div class="close-button">
|
|
|
|
<RadzenButton Text="Close" Click="CloseImageInfo" />
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2023-08-04 17:05:25 +02:00
|
|
|
@code {
|
|
|
|
string selectedImage;
|
|
|
|
string infoText = "Info Text";
|
|
|
|
string popupStyle = "display: none;";
|
|
|
|
|
2023-10-10 18:56:05 +02:00
|
|
|
IEnumerable<BildInfoModel>? _bildInfos;
|
|
|
|
|
2023-08-04 17:05:25 +02:00
|
|
|
protected override async Task OnInitializedAsync()
|
|
|
|
{
|
|
|
|
await base.OnInitializedAsync();
|
|
|
|
|
2023-10-10 18:56:05 +02:00
|
|
|
_bildInfos = await BildInfoData.GetAllBildInfosAsync();
|
2023-08-04 17:05:25 +02:00
|
|
|
}
|
|
|
|
|
2023-10-10 18:56:05 +02:00
|
|
|
private async void ShowImageInfo(BildInfoModel bildInfo)
|
2023-08-04 17:05:25 +02:00
|
|
|
{
|
2023-10-10 18:56:05 +02:00
|
|
|
selectedImage = bildInfo.Dateiname;
|
2023-08-04 17:05:25 +02:00
|
|
|
popupStyle = "display: block;";
|
2023-08-18 11:52:58 +02:00
|
|
|
|
2023-10-10 18:56:05 +02:00
|
|
|
WunschInfoModel wunschInfo = await WunschInfoData.GetWunschInfoAsync(bildInfo.WunschId);
|
|
|
|
infoText = wunschInfo.BildBeschreibung;
|
2023-08-04 17:05:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
private void CloseImageInfo()
|
|
|
|
{
|
|
|
|
popupStyle = "display: none;";
|
|
|
|
}
|
|
|
|
|
|
|
|
[Inject]
|
|
|
|
private IWebHostEnvironment _environment { get; set; }
|
|
|
|
}
|