FluentCMS icon indicating copy to clipboard operation
FluentCMS copied to clipboard

Add File Details Modal

Open TheHadiAhmadi opened this issue 1 year ago • 0 comments

@inherits BasePlugin

<PluginBody Title="File Details">
    <CardBody>
        @if (Model != null)
        {
            <Stack Vertical Items="StackItems.Start">
                @if (Model.ContentType.StartsWith("image/"))
                {
                    <img src="/Api/File/Download/@Model.Id" />
                }
                <div><b>Name:</b>@Model.Name</div>
                <div><b>Mime Type:</b>@Model.ContentType</div>
                <div><b>Extension:</b>@Model.Extension</div>
                <div><b>Size:</b>@Model.Size</div>
            </Stack>
        }
        <Spacer />
        <FormActions>
            <Button Href="@GetUrl("Files List", new { folderId = FolderId })" Outline>
                Back
            </Button>
        </FormActions>
    </CardBody>
</PluginBody>

@code {
    private FileDetailResponse Model { get; set; }

    [SupplyParameterFromQuery(Name = "id")]
    private Guid Id { get; set; }

    [SupplyParameterFromQuery(Name = "folderId")]
    private Guid? FolderId { get; set; }

    protected override async Task OnInitializedAsync()
    {
        var fileResponse = await GetApiClient<FileClient>().GetByIdAsync(Id);
        Model = fileResponse?.Data;
    }
}

TheHadiAhmadi avatar Jun 17 '24 19:06 TheHadiAhmadi