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

42 lines
1.4 KiB
Plaintext

<!--
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "title" -}}
{{( pgettext "Campsites" "title" )}}
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite.campsiteIndex*/ -}}
<a href="/admin/campsites/new">{{( pgettext "Add Campsite" "action" )}}</a>
<h2>{{( pgettext "Campsites" "title" )}}</h2>
{{ template "campground_map.svg" }}
{{ if .Campsites -}}
<table>
<thead>
<tr>
<th scope="col">{{( pgettext "Label" "header" )}}</th>
<th scope="col">{{( pgettext "Type" "header" )}}</th>
<th scope="col">{{( pgettext "Active" "campsite" )}}</th>
</tr>
</thead>
<tbody>
{{ range .Campsites -}}
<tr>
<td><a href="/admin/campsites/{{ .Label }}">{{ .Label }}</a></td>
<td>{{ .Type }}</td>
<td>{{ if .Active }}{{( gettext "Yes" )}}{{ else }}{{( gettext "No" )}}{{ end }}</td>
</tr>
{{- end }}
</tbody>
</table>
{{ else -}}
<p>{{( gettext "No campsites added yet." )}}</p>
{{- end }}
<script type="module">
import {setupCampgroundMap} from "/static/camper.js";
setupCampgroundMap(document.getElementById('campground-map'));
</script>
{{- end }}