Group items by folder

This commit is contained in:
Thorsten Sommer 2025-12-18 14:30:28 +01:00
parent 9c95ff9c0f
commit 1b0a7211d7
Signed by: tsommer
GPG Key ID: 371BBA77A02C0108

View File

@ -21,54 +21,69 @@
</MudJustifiedText> </MudJustifiedText>
} }
@foreach (var filePath in this.DocumentPaths) @{
{ var currentFolder = string.Empty;
@if (File.Exists(filePath)) foreach (var filePath in this.DocumentPaths)
{ {
<MudStack Row Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center" Class="mb-2"> var folderPath = Path.GetDirectoryName(filePath);
<div style="min-width: 0; flex: 1; overflow: hidden;"> if (folderPath != currentFolder)
<MudTooltip Text="@T("Your attached file.")" Placement="Placement.Bottom"> {
<span class="d-inline-flex align-items-center" style="overflow: hidden; width: 100%;"> currentFolder = folderPath;
<MudIcon Icon="@Icons.Material.Filled.AttachFile" Class="mr-2" Style="flex-shrink: 0;"/> <MudStack Row="true" AlignItems="AlignItems.Center" Class="mt-6 mb-3">
<MudText Style="white-space: nowrap;"> <MudIcon Icon="@Icons.Material.Filled.Folder" Class="mr-2" />
@Path.GetFileName(filePath) <MudText Typo="Typo.h6">
</MudText> @folderPath:
</span> </MudText>
</MudStack>
}
@if (File.Exists(filePath))
{
<MudStack Row Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center" Class="ms-3 mb-2">
<div style="min-width: 0; flex: 1; overflow: hidden;">
<MudTooltip Text="@T("Your attached file.")" Placement="Placement.Bottom">
<span class="d-inline-flex align-items-center" style="overflow: hidden; width: 100%;">
<MudIcon Icon="@Icons.Material.Filled.AttachFile" Class="mr-2" Style="flex-shrink: 0;"/>
<MudText Style="white-space: nowrap;">
@Path.GetFileName(filePath)
</MudText>
</span>
</MudTooltip>
</div>
<MudTooltip Text="@T("Remove this attachment.")" Placement="Placement.Bottom">
<MudIconButton Icon="@Icons.Material.Filled.Delete"
Color="Color.Error"
Class="ml-2"
Style="flex-shrink: 0;"
OnClick="@(() => this.DeleteAttachment(filePath))"/>
</MudTooltip> </MudTooltip>
</div> </MudStack>
<MudTooltip Text="@T("Remove this attachment.")" Placement="Placement.Bottom"> }
<MudIconButton Icon="@Icons.Material.Filled.Delete" else
Color="Color.Error" {
Class="ml-2" <MudStack Row Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center" Class="ms-3 mb-2">
Style="flex-shrink: 0;" <div style="min-width: 0; flex: 1; overflow: hidden;">
OnClick="@(() => this.DeleteAttachment(filePath))"/> <MudTooltip Text="@T("The file was deleted, renamed, or moved.")" Placement="Placement.Bottom">
</MudTooltip> <span class="d-inline-flex align-items-center" style="overflow: hidden; width: 100%;">
</MudStack> <MudIcon Icon="@Icons.Material.Filled.Report" Color="Color.Error" Class="mr-2" Style="flex-shrink: 0;"/>
<MudText Style="white-space: nowrap;">
<s>@Path.GetFileName(filePath)</s>
</MudText>
</span>
</MudTooltip>
</div>
} <MudTooltip Text="@T("Remove this attachment.")" Placement="Placement.Bottom">
else <MudIconButton Icon="@Icons.Material.Filled.Delete"
{ Color="Color.Error"
<MudStack Row Justify="Justify.SpaceBetween" AlignItems="AlignItems.Center" Class="mb-2"> Class="ml-2"
<div style="min-width: 0; flex: 1; overflow: hidden;"> Style="flex-shrink: 0;"
<MudTooltip Text="@T("The file was deleted, renamed, or moved.")" Placement="Placement.Bottom"> OnClick="@(() => this.DeleteAttachment(filePath))"/>
<span class="d-inline-flex align-items-center" style="overflow: hidden; width: 100%;">
<MudIcon Icon="@Icons.Material.Filled.Report" Color="Color.Error" Class="mr-2" Style="flex-shrink: 0;"/>
<MudText Style="white-space: nowrap;">
<s>@Path.GetFileName(filePath)</s>
</MudText>
</span>
</MudTooltip> </MudTooltip>
</div> </MudStack>
}
<MudTooltip Text="@T("Remove this attachment.")" Placement="Placement.Bottom">
<MudIconButton Icon="@Icons.Material.Filled.Delete"
Color="Color.Error"
Class="ml-2"
Style="flex-shrink: 0;"
OnClick="@(() => this.DeleteAttachment(filePath))"/>
</MudTooltip>
</MudStack>
} }
} }
</div> </div>