camper/web/templates/admin/amenity/feature/index.gohtml

59 lines
2.2 KiB
Plaintext

<!--
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
{{( pgettext "Amenity Features" "title" )}}
{{- end }}
{{ define "breadcrumb" -}}
<li><a href="/admin/amenities">{{( pgettext "Amenities" "title" )}}</a></li>
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/amenity.featureIndex*/ -}}
<a href="/admin/amenities/{{ .Label }}/features/new">{{( pgettext "Add Feature" "action" )}}</a>
<h2>{{ template "title" . }}</h2>
{{ if .Features -}}
<form id="feature-index"
class="sortable"
data-hx-post="/admin/amenities/{{ .Label }}/features/order"
data-hx-trigger="end"
data-hx-select="#feature-index"
data-hx-swap="outerHTML"
>
{{ CSRFInput }}
<table class="services">
<thead>
<tr>
<th scope="col" style="width: 1.5em"></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 feature?")}}
{{ range .Features -}}
<tr>
<td>
<span class="handle"></span>
<input type="hidden" name="feature_id" value="{{ .ID }}">
</td>
<td class="icon_{{ .Icon }}"><a href="{{ .URL }}">{{ .Name }}</a></td>
<td>
<button data-hx-delete="{{ .URL }}"
data-hx-confirm="{{ $confirm }}"
data-hx-headers='{ {{ CSRFHeader }} }'>
{{( pgettext "Delete" "action" )}}
</button>
</td>
</tr>
{{- end }}
</tbody>
</table>
</form>
{{ else -}}
<p>{{( gettext "No amenity features added yet." )}}</p>
{{- end }}
{{- end }}