camper/web/templates/admin/form.gohtml
jordi fita mas 0cbf973cbb Add the payment form to admin
Had to change setup_redsys because admins can not read the current
encrypt key, thus it is not possible to `set encrypt_key =
coalesce(…, encrypt_key)`.

Not that it did much sense, anyway, as i was already inside the branch
of the if when encrpty_key is null.

However, it seems that this also affects in the `on conflict` update. I
assume this is because `excluded` is some kind of row of the relation
and has the same restrictions.
2023-10-27 16:08:13 +02:00

44 lines
1.6 KiB
Plaintext

<!--
SPDX-FileCopyrightText: 2023 jordi fita mas <jordi@tandem.blog>
SPDX-License-Identifier: AGPL-3.0-only
-->
{{ define "error-attrs" }}{{ if .Error }}aria-invalid="true" aria-errormessage="{{ .Name }}-error"{{ end }}{{ end }}
{{ define "error-message" -}}
{{ if .Error -}}
<span id="{{ .Name }}-error" class="error">{{ .Error }}</span><br>
{{- end }}
{{- end }}
{{ define "list-options" -}}
{{- range .Options }}
<option value="{{ .Value }}" {{ if $.IsSelected .Value }} selected="selected"{{ end }}>{{ .Label }}</option>
{{- end }}
{{- end }}
{{ define "radio-options" -}}
{{- range .Options }}
<label><input type="radio" name="{{ $.Name }}" value="{{ .Value }}"
{{ if $.IsSelected .Value }}checked{{ end }}> {{ .Label }}</label>
{{- end }}
{{- end }}
{{ define "media-picker" -}}
{{- /*gotype: dev.tandem.ws/tandem/camper/pkg/form.Media*/ -}}
<fieldset data-hx-target="this" data-hx-swap="outerHTML">
<legend>{{( pgettext .Label "input" )}}</legend>
<input type="hidden" name="{{ .Name }}" value="{{ .Val }}">
<button type="button"
data-hx-get="/admin/media/picker?name={{ .Name | queryEscape }}&amp;value={{ .Val | queryEscape }}&amp;label={{ .Label | queryEscape }}&amp;prompt={{ .Prompt | queryEscape }}"
data-hx-swap="beforeend"
>
{{ if .Val -}}
<img src="/admin/media/{{ .Val }}/content" alt="">
{{ else -}}
{{( pgettext .Prompt "action" )}}
{{- end }}
</button>
{{ template "error-message" . }}
</fieldset>
{{- end }}