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

66 lines
2.1 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/home.slideForm*/ -}}
{{ if .ID}}
{{( pgettext "Edit Carousel Slide" "title" )}}
{{ else }}
{{( pgettext "New Carousel Slide" "title" )}}
{{ end }}
{{- end }}
{{ define "content" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/home.slideForm*/ -}}
{{ template "settings-tabs" "home" }}
<form
enctype="multipart/form-data"
{{ if .ID }}
data-hx-put="/admin/home/slides/{{ .ID }}"
{{ else }}
action="/admin/home/slides" method="post"
{{ end }}
>
<h2>
{{ if .ID }}
{{( pgettext "Edit Carousel Slide" "title" )}}
{{ else }}
{{( pgettext "New Carousel Slide" "title" )}}
{{ end }}
</h2>
{{ CSRFInput }}
<fieldset>
{{ with .Media -}}
{{ if .Val -}}
<img src="{{ .Val }}" alt="">
{{- end }}
<label>
{{( pgettext "Cover image" "input" )}}
<input type="file" name="{{ .Name }}"
{{ if not $.ID }}required{{ end }}
{{ template "error-attrs" . }}><br>
</label>
{{ template "error-message" . }}
{{- end }}
{{ with .Caption -}}
<label>
{{( pgettext "Caption" "input")}}<br>
<input type="text" name="{{ .Name }}" value="{{ .Val }}"
{{ 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 }}