PlotDirector/PlotLine/Views/StoryAssets/_AssetPrimaryImage.cshtml

31 lines
1.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@model (int Id, string Name, string? ImagePath, string? ThumbnailPath)
<section class="plain-card mb-3" aria-labelledby="asset-primary-image-heading">
<h2 id="asset-primary-image-heading">Asset image</h2>
@if (TempData["ImageError"] is string imageError)
{
<div class="alert alert-warning" role="alert">@imageError</div>
}
@if (TempData["AssetImageSaved"] is string imageSaved)
{
<span hidden data-toast-message="success">@imageSaved</span>
}
<div class="visual-image-editor flex-wrap">
<partial name="_Avatar" model="@(new AvatarViewModel { DisplayName = Model.Name, ImagePath = Model.ImagePath, ThumbnailPath = Model.ThumbnailPath, Size = "lg", Lazy = false })" />
<form asp-action="SaveImage" method="post" enctype="multipart/form-data" class="visual-image-editor__controls mw-100">
<input type="hidden" name="id" value="@Model.Id" />
<label for="asset-primary-image-upload" class="form-label">Upload image</label>
<input id="asset-primary-image-upload" name="upload" class="form-control" type="file"
accept=".jpg,.jpeg,.png,.webp,image/jpeg,image/png,image/webp" aria-describedby="asset-primary-image-format" />
<div id="asset-primary-image-format" class="form-text">JPG, PNG or WebP. A 128 × 128 thumbnail is generated automatically.</div>
<div class="button-row mt-2">
<button class="btn btn-outline-primary" type="submit" name="operation" value="upload">Save image</button>
@if (!string.IsNullOrWhiteSpace(Model.ImagePath) || !string.IsNullOrWhiteSpace(Model.ThumbnailPath))
{
<button class="btn btn-outline-secondary" type="submit" name="operation" value="remove">Remove image</button>
}
</div>
</form>
</div>
</section>