78 lines
2.7 KiB
Plaintext
78 lines
2.7 KiB
Plaintext
<!--
|
|
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
{{ define "title" -}}
|
|
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite.campsiteForm*/ -}}
|
|
{{ if .ID }}
|
|
{{( pgettext "Edit Campsite" "title" )}}
|
|
{{ else }}
|
|
{{( pgettext "New Campsite" "title" )}}
|
|
{{ end }}
|
|
{{- end }}
|
|
|
|
{{ define "content" -}}
|
|
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite.campsiteForm*/ -}}
|
|
<form
|
|
{{ if .ID }}
|
|
data-hx-put="/admin/campsites/{{ .CurrentLabel }}"
|
|
{{ else }}
|
|
action="/admin/campsites" method="post"
|
|
{{ end }}
|
|
>
|
|
<h2>
|
|
{{ if .ID }}
|
|
{{( pgettext "Edit Campsite" "title" )}}
|
|
{{ else }}
|
|
{{( pgettext "New Campsite" "title" )}}
|
|
{{ end }}
|
|
</h2>
|
|
{{ CSRFInput }}
|
|
<fieldset>
|
|
{{ if .ID }}
|
|
{{ with .Active -}}
|
|
<label>
|
|
<input type="checkbox" name="{{ .Name }}" {{ if .Checked}}checked{{ end }}
|
|
{{ template "error-attrs" . }}>
|
|
{{( pgettext "Active" "campsite" )}}<br>
|
|
</label>
|
|
{{ template "error-message" . }}
|
|
{{- end }}
|
|
{{ else }}
|
|
<input type="hidden" name="{{ .Active.Name }}" value="true">
|
|
{{ end }}
|
|
{{ with .CampsiteType -}}
|
|
<label>
|
|
{{( pgettext "Campsite Type" "input")}}<br>
|
|
<select name="{{ .Name }}"
|
|
required
|
|
{{ template "error-attrs" . }}>
|
|
{{ if not $.ID }}
|
|
<option value="">{{( gettext "Select campsite type" )}}</option>
|
|
{{ end }}
|
|
{{ template "list-options" . }}
|
|
</select><br>
|
|
</label>
|
|
{{ template "error-message" . }}
|
|
{{- end }}
|
|
{{ with .Label -}}
|
|
<label>
|
|
{{( pgettext "Label" "input")}}<br>
|
|
<input type="text" name="{{ .Name }}" value="{{ .Val }}"
|
|
required {{ template "error-attrs" . }}><br>
|
|
</label>
|
|
{{ template "error-message" . }}
|
|
{{- end }}
|
|
</fieldset>
|
|
<footer>
|
|
<button type="submit">
|
|
{{ if .ID }}
|
|
{{( pgettext "Update" "action" )}}
|
|
{{ else }}
|
|
{{( pgettext "Add" "action" )}}
|
|
{{ end }}
|
|
</button>
|
|
</footer>
|
|
</form>
|
|
{{- end }}
|