<!--
 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 }}
