{% macro _key_fmt(key) %}{{ key }}{% endmacro %} {% macro _value_fmt(value) %}{{ value }}{% endmacro %} {% macro m_audit_field_changes(changes) %} {% endmacro %} {% macro m_audit_entry(entry) %}
{#- FIXME: use macro for user avatar #} {{ entry.user.name }} {%- if entry.related or entry.op == 1 %} made changes on {{ entry.happened_at.strftime('%Y-%m-%d %H:%M') }} {{ m_audit_field_changes(entry.changes) }} {%- elif entry.type == 0 %} created this record on {{ entry.happened_at.strftime('%Y-%m-%d %H:%M') }} {%- endif %}
{% endmacro %} {% macro m_audit_log(entries) %} {%- if entries %}
{%- for entry in entries %} {{ m_audit_entry(entry) }} {%- endfor %}
{%- endif %} {% endmacro %}