fix: admin FileUpload single-path columns (array state + dehydrate — was foreach error = admin edit 500); user photo upload targets thumb div only so the form/button survives re-uploads
This commit is contained in:
@@ -53,9 +53,11 @@
|
|||||||
<!-- Standalone photo upload (outside the main form — nested forms are invalid HTML) -->
|
<!-- Standalone photo upload (outside the main form — nested forms are invalid HTML) -->
|
||||||
<div class="mt-4 rounded-xl border border-stone-200 bg-white p-4 shadow-sm">
|
<div class="mt-4 rounded-xl border border-stone-200 bg-white p-4 shadow-sm">
|
||||||
<h2 class="text-sm font-bold">Photo</h2>
|
<h2 class="text-sm font-bold">Photo</h2>
|
||||||
<div id="photo-area" class="mt-2">
|
<div id="photo-thumb" class="mt-2">
|
||||||
{{if .Data.PhotoUrl.Valid}}<img src="{{.Data.PhotoUrl.String}}" alt="Current photo" class="mb-2 h-32 w-32 rounded-lg object-cover">{{end}}
|
{{if .Data.PhotoUrl.Valid}}<img src="{{.Data.PhotoUrl.String}}" alt="Current photo" class="mb-2 h-32 w-32 rounded-lg object-cover">{{end}}
|
||||||
<form hx-encoding="multipart/form-data" hx-post="/account/tags/{{.Data.ID}}/photo" hx-target="#photo-area" hx-swap="innerHTML" class="flex gap-2">
|
</div>
|
||||||
|
<div class="mt-2">
|
||||||
|
<form hx-encoding="multipart/form-data" hx-post="/account/tags/{{.Data.ID}}/photo" hx-target="#photo-thumb" hx-swap="innerHTML" class="flex gap-2">
|
||||||
<input type="file" name="photo" accept="image/*" class="text-sm">
|
<input type="file" name="photo" accept="image/*" class="text-sm">
|
||||||
<button type="submit" class="rounded bg-stone-900 px-3 py-1.5 text-xs font-semibold text-white hover:bg-stone-700">Upload photo</button>
|
<button type="submit" class="rounded bg-stone-900 px-3 py-1.5 text-xs font-semibold text-white hover:bg-stone-700">Upload photo</button>
|
||||||
<span class="htmx-indicator self-center text-xs text-stone-400">Uploading…</span>
|
<span class="htmx-indicator self-center text-xs text-stone-400">Uploading…</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user