{#- 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) %}
{{ errors(field) }}
{% endmacro %} {#- Files, each sent as soon as it is picked. A message's own files, when it is edited, are listed first, each with a button that marks it to be removed on saving. -#} {% macro attachments_field(field, existing=()) %}
{{ _("Attachments") }}
{% for a in existing %}
{{ a.name }} ยท {{ a.content_length | filesize }}
{% endfor %}
{% endmacro %} {#- Offered where the view allows it (`BaseThreadView.can_send_by_mail`). -#} {% macro send_by_email(form) %} {% if "send_by_email" in form %} {% endif %} {% endmacro %}