camper/web/templates/admin/season/form.gohtml

73 lines
2.5 KiB
Plaintext
Raw Normal View History

<!--
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/season.seasonForm*/ -}}
{{ if .Slug}}
{{( pgettext "Edit Season" "title" )}}
{{ else }}
{{( pgettext "New Season" "title" )}}
{{ end }}
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/season.seasonForm*/ -}}
{{ template "settings-tabs" "seasons" }}
<form
{{ if .Slug }}
data-hx-put="/admin/seasons/{{ .Slug }}"
{{ else }}
action="/admin/seasons" method="post"
{{ end }}
>
<h2>
{{ if .Slug }}
{{( pgettext "Edit Season" "title" )}}
{{ else }}
{{( pgettext "New Season" "title" )}}
{{ end }}
</h2>
{{ CSRFInput }}
<fieldset>
{{ if .Slug }}
{{ with .Active -}}
<label>
<input type="checkbox" name="{{ .Name }}" {{ if .Checked}}checked{{ end }}
{{ template "error-attrs" . }}>
{{( pgettext "Active" "season" )}}<br>
</label>
{{ template "error-message" . }}
{{- end }}
{{ else }}
<input type="hidden" name="{{ .Active.Name }}" value="true">
{{ end }}
{{ with .Name -}}
<label>
{{( pgettext "Name" "input")}}<br>
<input type="text" name="{{ .Name }}" value="{{ .Val }}"
required {{ template "error-attrs" . }}><br>
</label>
{{ template "error-message" . }}
{{- end }}
{{ with .Color -}}
<label>
{{( pgettext "Color" "input")}}<br>
<input type="color" name="{{ .Name }}" value="{{ .Val }}"
required {{ template "error-attrs" . }}><br>
</label>
{{ template "error-message" . }}
{{- end }}
</fieldset>
<footer>
<button type="submit">
{{ if .Slug }}
{{( pgettext "Update" "action" )}}
{{ else }}
{{( pgettext "Add" "action" )}}
{{ end }}
</button>
</footer>
</form>
{{- end }}