{#- The fields of a message, shared by a reply, a new discussion and an edit, on the Abilian Design System. Without their scripts, the textarea is the field and the file input posts nothing: editor.js replaces the one, widgets/file.js uploads through the other. -#} {#- What the server refused in a field, said under it: one element, one id, whatever the number of errors. -#} {% macro errors(field) -%} {% if field.errors %}{{ field.errors | join(" ") }}{% endif %} {%- endmacro %} {#- The attributes that tie a field to its help, if `help` names it, and its errors: one `aria-describedby`, for a second one would be ignored. -#} {% macro invalid(field, help=none) -%} {% set ids = ([help] if help else []) + ([field.id ~ "-error"] if field.errors else []) %} {% if field.errors %}aria-invalid="true" {% endif %}{% if ids %}aria-describedby="{{ ids | join(' ') }}"{% endif %} {%- endmacro %} {#- The message, in the rich-text editor. Its tools are only those the server's sanitiser keeps (`forum/forms.py`). -#} {% macro message_field(field, label, rows=6) %}