camper/web/templates/admin/amenity/carousel/form.gohtml

58 lines
2.2 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/amenity.slideForm*/ -}}
{{- if .MediaID -}}
{{( pgettext "Edit Amenity Carousel Slide" "title" )}}
{{- else -}}
{{( pgettext "New Amenity Carousel Slide" "title" )}}
{{- end -}}
{{- end }}
{{ define "breadcrumb" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/amenity/types.slideForm*/ -}}
<li><a href="/admin/amenities">{{( pgettext "Amenities" "title" )}}</a></li>
<li><a href="/admin/amenities/{{ .Label }}/slides">{{( pgettext "Amenity Carousel" "title" )}}</a></li>
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/amenity.slideForm*/ -}}
<form
{{- if .MediaID }} data-hx-put="/admin/amenities/{{ .Label }}/slides/{{ .MediaID }}"
{{- else }} action="/admin/amenities/{{ .Label }}/slides" method="post"
{{- end -}}
>
<h2>{{ template "title" . }}</h2>
{{ CSRFInput }}
<fieldset {{ template "init-lang" . }}>
{{ with .Media -}}
{{ template "media-picker" . }}
{{- end }}
{{ with .Caption -}}
<fieldset>
<legend>{{( pgettext "Caption" "input")}}</legend>
{{ template "lang-selector" . }}
{{ range $lang, $input := . -}}
<label x-cloak x-show="lang === '{{ $lang }}'"><span>{{ $lang }}</span><br>
<input type="text" name="{{ $input.Name }}" value="{{ $input.Val }}"
{{ template "error-attrs" . }}><br>
</label>
{{- end }}
{{ template "error-message" . }}
</fieldset>
{{- end }}
</fieldset>
<footer>
<button type="submit">
{{ if .MediaID }}
{{( pgettext "Update" "action" )}}
{{ else }}
{{( pgettext "Add" "action" )}}
{{ end }}
</button>
</footer>
</form>
{{- end }}