81 lines
3.0 KiB
Plaintext
81 lines
3.0 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/types.featureForm*/ -}}
|
|
{{ if .ID}}
|
|
{{( pgettext "Edit Campsite Type Feature" "title" )}}
|
|
{{ else }}
|
|
{{( pgettext "New Campsite Type Feature" "title" )}}
|
|
{{ end }}
|
|
{{- end }}
|
|
|
|
{{ define "content" -}}
|
|
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/campsite/types.featureForm*/ -}}
|
|
<form
|
|
{{ if .ID }}
|
|
data-hx-put="/admin/campsites/types/{{ .TypeSlug }}/features/{{ .ID }}"
|
|
{{ else }}
|
|
action="/admin/campsites/types/{{ .TypeSlug }}/features" method="post"
|
|
{{ end }}
|
|
>
|
|
<h2>
|
|
{{ if .ID }}
|
|
{{( pgettext "Edit Campsite Type Feature" "title" )}}
|
|
{{ else }}
|
|
{{( pgettext "New Campsite Type Feature" "title" )}}
|
|
{{ end }}
|
|
</h2>
|
|
{{ CSRFInput }}
|
|
<fieldset x-data="{ lang: '{{ .DefaultLang }}' }">
|
|
{{ with $field := .Icon -}}
|
|
<fieldset class="icon-input">
|
|
<legend>{{( pgettext "Icon" "input")}}</legend>
|
|
<input type="hidden" name="{{ .Name }}"
|
|
{{- range .Options }}
|
|
{{ if $field.IsSelected .Value }} value="{{ .Value }}"{{ end }}
|
|
{{- end }}
|
|
>
|
|
<ul>
|
|
{{- range .Options }}
|
|
<li>
|
|
<button type="button" data-icon-name="{{ .Value }}" class="icon_{{ .Value }}"></button>
|
|
</li>
|
|
{{- end }}
|
|
</ul>
|
|
{{ template "error-message" . }}
|
|
</fieldset>
|
|
{{- end }}
|
|
{{ with .Name -}}
|
|
<fieldset>
|
|
<legend>{{( pgettext "Name" "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 .ID }}
|
|
{{( pgettext "Update" "action" )}}
|
|
{{ else }}
|
|
{{( pgettext "Add" "action" )}}
|
|
{{ end }}
|
|
</button>
|
|
</footer>
|
|
</form>
|
|
|
|
<script type="module">
|
|
import {setupIconInput} from "/static/camper.js";
|
|
|
|
setupIconInput(document.querySelector('.icon-input'));
|
|
</script>
|
|
{{- end }}
|