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

56 lines
2.0 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 "breadcrumb" -}}
{{- 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>
<div id="campground_map">
{{ template "campground_map.svg" }}
</div>
{{ if .Campsites -}}
<table>
<thead>
<tr>
<th scope="col">{{( pgettext "Label" "header" )}}</th>
<th scope="col">{{( pgettext "Type" "header" )}}</th>
<th scope="col">{{( pgettext "Features" "header" )}}</th>
<th scope="col">{{( pgettext "Carousel" "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>
<a href="/admin/campsites/{{ .Label }}/features">{{( pgettext "Edit Features" "action" )}}</a>
</td>
<td>
<a href="/admin/campsites/{{ .Label }}/slides">{{( pgettext "Edit Carousel" "action" )}}</a>
</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?v=";
setupCampgroundMap(document.getElementById('campground_map'));
</script>
{{- end }}