camper/web/templates/admin/surroundings/index.gohtml

56 lines
2.2 KiB
Plaintext

<!--
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
{{( pgettext "Surroundings Page" "title" )}}
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/surroundings.highlightIndex*/ -}}
<h2>{{( pgettext "Highlights" "title" )}}</h2>
<a href="/admin/surroundings/new">{{( pgettext "Add highlight" "action" )}}</a>
{{ if .Highlights -}}
<form id="highlight-index"
class="sortable"
data-hx-post="/admin/surroundings/order"
data-hx-trigger="end"
data-hx-select="#highlight-index"
data-hx-swap="outerHTML"
>
{{ CSRFInput }}
<table>
<thead>
<tr>
<th scope="col">{{( pgettext "Image" "header" )}}</th>
<th scope="col">{{( pgettext "Name" "header" )}}</th>
<th scope="col">{{( pgettext "Actions" "header" )}}</th>
</tr>
</thead>
<tbody>
{{ $confirm := ( gettext "Are you sure you wish to delete this highlight?" )}}
{{ range $highlight := .Highlights -}}
<tr>
<td>
<span class="handle"></span>
<input type="hidden" name="highlight_id" value="{{ .ID }}">
<a href="{{ .URL }}"><img src="{{ .Media }}" alt=""></a>
</td>
<td><a href="{{ .URL }}">{{ .Name }}</a></td>
<td>
<form data-hx-delete="/admin/surroundings//{{ .ID }}"
data-hx-confirm="{{ $confirm }}"
data-hx-headers='{ {{ CSRFHeader }} }'>
<button type="submit">{{( pgettext "Delete" "action" )}}</button>
</form>
</td>
</tr>
{{- end }}
</tbody>
</table>
</form>
{{ else -}}
<p>{{( gettext "No highlights added yet." )}}</p>
{{- end }}
{{- end }}