Avoid nested forms in admin

I was using a <form> to delete slides and other such elements before
adding the form to sort these same elements with drag and drop, without
realizing that i was wrapping the existing delete <form>s, that now
would not submit properly—they were submitting the sort form instead.
This commit is contained in:
jordi fita mas 2024-01-16 18:32:02 +01:00
parent 36213c75de
commit 89f8f91a4b
4 changed files with 25 additions and 25 deletions

View File

@ -39,11 +39,11 @@
</td>
<td><a href="/admin/campsites/types/{{ $.TypeSlug }}/slides/{{ .ID }}">{{ .Caption }}</a></td>
<td>
<form data-hx-delete="/admin/campsites/types/{{ $.TypeSlug }}/slides/{{ .ID }}"
<button data-hx-delete="/admin/campsites/types/{{ $.TypeSlug }}/slides/{{ .ID }}"
data-hx-confirm="{{ $confirm }}"
data-hx-headers='{ {{ CSRFHeader }} }'>
<button type="submit">{{( pgettext "Delete" "action" )}}</button>
</form>
{{( pgettext "Delete" "action" )}}
</button>
</td>
</tr>
{{- end }}

View File

@ -38,11 +38,11 @@
</td>
<td><a href="/admin/home/slides/{{ .ID }}">{{ .Caption }}</a></td>
<td>
<form data-hx-delete="/admin/home/slides/{{ .ID }}"
<button data-hx-delete="/admin/home/slides/{{ .ID }}"
data-hx-confirm="{{ $confirm }}"
data-hx-headers='{ {{ CSRFHeader }} }'>
<button type="submit">{{( pgettext "Delete" "action" )}}</button>
</form>
{{( pgettext "Delete" "action" )}}
</button>
</td>
</tr>
{{- end }}

View File

@ -38,11 +38,11 @@
</td>
<td><a href="/admin/services/slides/{{ .ID }}">{{ .Caption }}</a></td>
<td>
<form data-hx-delete="/admin/services/slides/{{ .ID }}"
<button data-hx-delete="/admin/services/slides/{{ .ID }}"
data-hx-confirm="{{ $confirm }}"
data-hx-headers='{ {{ CSRFHeader }} }'>
<button type="submit">{{( pgettext "Delete" "action" )}}</button>
</form>
{{( pgettext "Delete" "action" )}}
</button>
</td>
</tr>
{{- end }}
@ -82,11 +82,11 @@
</td>
<td class="icon_{{ .Icon }}"><a href="{{ .URL }}">{{ .Name }}</a></td>
<td>
<form data-hx-delete="{{ .URL }}"
<button data-hx-delete="{{ .URL }}"
data-hx-confirm="{{ $confirm }}"
data-hx-headers='{ {{ CSRFHeader }} }'>
<button type="submit">{{( pgettext "Delete" "action" )}}</button>
</form>
{{( pgettext "Delete" "action" )}}
</button>
</td>
</tr>
{{- end }}

View File

@ -38,11 +38,11 @@
</td>
<td><a href="{{ .URL }}">{{ .Name }}</a></td>
<td>
<form data-hx-delete="/admin/surroundings//{{ .ID }}"
<button data-hx-delete="/admin/surroundings//{{ .ID }}"
data-hx-confirm="{{ $confirm }}"
data-hx-headers='{ {{ CSRFHeader }} }'>
<button type="submit">{{( pgettext "Delete" "action" )}}</button>
</form>
{{( pgettext "Delete" "action" )}}
</button>
</td>
</tr>
{{- end }}