{% from "macros/user.html" import m_user_photo, m_user_link %} {% from "macros/form.html" import m_field %} {# default macros for displaying attachments #} {# attachments list #} {% macro m_attachments(entity) %} {%- if attachments.has_attachments(entity) %} {%- endif %} {% endmacro %} {# single attachment #} {% macro m_attachment(attachment) %} {%- set entity = attachment.entity %} {%- set manager = attachments.manager(entity) %} {%- set can_edit = manager.can_edit(entity) %} {%- set can_delete = manager.can_delete(entity) %}
{%- if can_edit or can_delete %}
{%- if can_edit %} {%- endif %} {%- if can_delete %} {%- endif %}
{%- endif %}

{{ attachment.name }} {{ attachment.blob.size | filesize }} - {{ attachment.updated_at | age }}

{{ attachment.description }}

{% endmacro %} {# new attachment form #} {% macro m_attachment_form(entity) %} {%- set ctx = attachments.get_form_context(entity) %}
{%- for field in ctx.form %} {{ m_field(field) }} {%- endfor %}
{%- for button in ctx.buttons %} {{ button.render() }} {%- endfor %}
{% endmacro %}