camper/web/templates/admin/campsite/option/index.gohtml

50 lines
1.7 KiB
Plaintext

<!--
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
{{( pgettext "Campsite Type Options" "title" )}}
{{- end }}
{{ define "breadcrumb" -}}
<li><a href="/admin/campsites">{{( pgettext "Campsites" "title" )}}</a></li>
<li><a href="/admin/campsites/types">{{( pgettext "Campsite Types" "title" )}}</a></li>
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.optionIndex*/ -}}
<a href="/admin/campsites/types/{{ .TypeSlug }}/options/new">{{( pgettext "Add Option" "action" )}}</a>
<h2>{{( pgettext "Campsite Type Options" "title" )}}</h2>
{{ if .Options -}}
<form id="option-index"
class="sortable"
data-hx-post="/admin/campsites/types/{{ .TypeSlug }}/options/order"
data-hx-trigger="end"
data-hx-select="#option-index"
data-hx-swap="outerHTML"
>
{{ CSRFInput }}
<table>
<thead>
<tr>
<th scope="col">{{( pgettext "Name" "header" )}}</th>
</tr>
</thead>
<tbody>
{{ range .Options -}}
<tr>
<td>
<span class="handle"></span>
<input type="hidden" name="option_id" value="{{ .ID }}">
<a href="{{ .URL }}">{{ .Name }}</a>
</td>
</tr>
{{- end }}
</tbody>
</table>
</form>
{{ else -}}
<p>{{( gettext "No campsite type options added yet." )}}</p>
{{- end }}
{{- end }}