92 lines
3.7 KiB
Plaintext
92 lines
3.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/legal.legalForm*/ -}}
|
|
{{ if .URL }}
|
|
{{( pgettext "Edit Legal Text" "title" )}}
|
|
{{ else }}
|
|
{{( pgettext "New Legal Text" "title" )}}
|
|
{{ end }}
|
|
{{- end }}
|
|
|
|
{{ define "content" -}}
|
|
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/legal.legalForm*/ -}}
|
|
<form
|
|
{{ if .URL }}
|
|
data-hx-put="{{ .URL }}"
|
|
{{ else }}
|
|
action="/admin/legal" method="post"
|
|
{{ end }}
|
|
>
|
|
<h2>
|
|
{{ if .URL }}
|
|
{{( pgettext "Edit Legal Text" "title" )}}
|
|
{{ else }}
|
|
{{( pgettext "New Legal Text" "title" )}}
|
|
{{ end }}
|
|
</h2>
|
|
{{ CSRFInput }}
|
|
<fieldset {{ template "init-lang" . }}>
|
|
{{ if .URL }}
|
|
<input type="hidden" name="{{ .Slug.Name }}" value="{{ .Slug.Val }}">
|
|
{{ else }}
|
|
{{ with .Slug -}}
|
|
<label>
|
|
{{( pgettext "Slug" "input")}}<br>
|
|
<input type="text" name="{{ .Name }}" value="{{ .Val }}"
|
|
required {{ template "error-attrs" . }}><br>
|
|
</label>
|
|
{{ template "error-message" . }}
|
|
{{- end }}
|
|
{{ end }}
|
|
{{ with .Name -}}
|
|
<fieldset>
|
|
<legend>{{( pgettext "Name" "input" )}}</legend>
|
|
<div class="lang-selector" role="toolbar">
|
|
{{ range $lang, $input := . -}}
|
|
<button :aria-pressed="lang === '{{ $lang }}'"
|
|
@click.prevent="lang = '{{ $lang }}'">{{ $lang }}</button>
|
|
{{- end }}
|
|
</div>
|
|
{{ 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 }}
|
|
{{ with .Content -}}
|
|
<fieldset>
|
|
<legend>{{( pgettext "Content" "input" )}}</legend>
|
|
<div class="lang-selector" role="toolbar">
|
|
{{ range $lang, $input := . -}}
|
|
<button :aria-pressed="lang === '{{ $lang }}'"
|
|
@click.prevent="lang = '{{ $lang }}'">{{ $lang }}</button>
|
|
{{- end }}
|
|
</div>
|
|
{{ range $lang, $input := . -}}
|
|
<label x-cloak x-show="lang === '{{ $lang }}'"><span>{{ $lang }}</span><br>
|
|
<textarea class="html"
|
|
name="{{ $input.Name }}" {{ template "error-attrs" . }}>{{ $input.Val }}</textarea><br>
|
|
</label>
|
|
{{- end }}
|
|
{{ template "error-message" . }}
|
|
</fieldset>
|
|
{{- end }}
|
|
</fieldset>
|
|
<footer>
|
|
<button type="submit">
|
|
{{ if .URL }}
|
|
{{( pgettext "Update" "action" )}}
|
|
{{ else }}
|
|
{{( pgettext "Add" "action" )}}
|
|
{{ end }}
|
|
</button>
|
|
</footer>
|
|
</form>
|
|
{{- end }}
|