61 lines
2.5 KiB
Plaintext
61 lines
2.5 KiB
Plaintext
<!--
|
|
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
{{ define "title" -}}
|
|
{{( pgettext "Campsite Carousel" "title" )}}
|
|
{{- end }}
|
|
|
|
{{ define "breadcrumb" -}}
|
|
<li><a href="/admin/campsites">{{( pgettext "Campsites" "title" )}}</a></li>
|
|
{{- end }}
|
|
|
|
{{ define "content" -}}
|
|
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite.carouselIndex*/ -}}
|
|
<h2>{{ template "title" . }}</h2>
|
|
<a href="/admin/campsites/{{ .Label }}/slides/new">{{( pgettext "Add slide" "action" )}}</a>
|
|
{{ if .Slides -}}
|
|
<form id="slide-index"
|
|
class="sortable"
|
|
data-hx-post="/admin/campsites/{{ .Label }}/slides/order"
|
|
data-hx-trigger="end"
|
|
data-hx-select="#slide-index"
|
|
data-hx-swap="outerHTML"
|
|
>
|
|
{{ CSRFInput }}
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">{{( pgettext "Image" "header" )}}</th>
|
|
<th scope="col">{{( pgettext "Caption" "header" )}}</th>
|
|
<th scope="col">{{( pgettext "Actions" "header" )}}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{{ $confirm := (gettext "Are you sure you wish to delete this slide?")}}
|
|
{{ range $slide := .Slides -}}
|
|
<tr>
|
|
<td>
|
|
<span class="handle"></span>
|
|
<input type="hidden" name="media_id" value="{{ .ID }}">
|
|
<a href="/admin/campsites/{{ $.Label }}/slides/{{ .ID }}"><img src="{{ .Media }}"
|
|
alt=""></a>
|
|
</td>
|
|
<td><a href="/admin/campsites/{{ $.Label }}/slides/{{ .ID }}">{{ .Caption }}</a></td>
|
|
<td>
|
|
<button data-hx-delete="/admin/campsites/{{ $.Label }}/slides/{{ .ID }}"
|
|
data-hx-confirm="{{ $confirm }}"
|
|
data-hx-headers='{ {{ CSRFHeader }} }'>
|
|
{{( pgettext "Delete" "action" )}}
|
|
</button>
|
|
</td>
|
|
</tr>
|
|
{{- end }}
|
|
</tbody>
|
|
</table>
|
|
</form>
|
|
{{ else -}}
|
|
<p>{{( gettext "No slides added yet." )}}</p>
|
|
{{- end }}
|
|
{{- end }}
|