fix: revert auto-submit — keep visible file input, remove capture only
This commit is contained in:
parent
0f53adc6a8
commit
cbd4ba09aa
1 changed files with 5 additions and 10 deletions
|
|
@ -35,17 +35,12 @@
|
||||||
|
|
||||||
<form method="post" action="{% url 'upload_photo' plant.pk %}" enctype="multipart/form-data"
|
<form method="post" action="{% url 'upload_photo' plant.pk %}" enctype="multipart/form-data"
|
||||||
hx-post="{% url 'upload_photo' plant.pk %}" hx-target="#photo-gallery" hx-swap="outerHTML"
|
hx-post="{% url 'upload_photo' plant.pk %}" hx-target="#photo-gallery" hx-swap="outerHTML"
|
||||||
hx-encoding="multipart/form-data" hx-indicator="#photo-upload-spinner"
|
hx-encoding="multipart/form-data" hx-indicator="#photo-upload-spinner">
|
||||||
id="photo-upload-form">
|
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
<input type="file" name="image" accept="image/*"
|
<div class="d-flex gap-2 align-items-center flex-wrap">
|
||||||
class="d-none" id="photo-file-input"
|
<input type="file" name="image" accept="image/*"
|
||||||
onchange="this.form.querySelector('#photo-upload-label').textContent = this.files[0]?.name ?? 'Add photo'; this.form.requestSubmit();">
|
class="form-control form-control-sm" style="max-width:220px;">
|
||||||
<div class="d-flex gap-2 align-items-center">
|
<button type="submit" class="btn btn-sm btn-outline-secondary">Upload</button>
|
||||||
<label for="photo-file-input" id="photo-upload-label"
|
|
||||||
class="btn btn-sm btn-outline-secondary mb-0" style="cursor:pointer;">
|
|
||||||
Add photo
|
|
||||||
</label>
|
|
||||||
<span id="photo-upload-spinner" class="htmx-indicator text-muted small">Uploading…</span>
|
<span id="photo-upload-spinner" class="htmx-indicator text-muted small">Uploading…</span>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue