{% from "leeuwenhoek/_macros.html" import time_ago, json_tree %} {% macro action_tag(action) -%} {%- set cls = {'created': 'is-success', 'updated': 'is-info', 'deleted': 'is-danger'}.get(action, '') -%} {{ action }} {%- endmacro %} {% macro key(c) %}{% if c.key is not none %}#{{ c.key | join(", ") if c.key is sequence and c.key is not string else c.key }}{% endif %}{% endmacro %} {% macro head() %}ModelActionKeyChangedWhen{% endmacro %} {% macro row(e) %} {{ e.content.model }} {{ action_tag(e.content.action) }} {{ key(e.content) }} {{ e.content.changes | join(", ") | lw_truncate(90) }} {{ time_ago(e.created_at) }} {% endmacro %} {% macro summary(e) %}{{ action_tag(e.content.action) }} {{ e.content.model }} {{ key(e.content) }}{% endmacro %} {% macro cell(v) %}{% if v is none %}null{% elif v is mapping or (v is sequence and v is not string) %}{{ json_tree(v) }}{% else %}{{ v }}{% endif %}{% endmacro %} {% macro detail(e) %} {% set c = e.content %}

{{ action_tag(c.action) }} {{ c.model }} {{ key(c) }} {%- if c.table %} ยท table {{ c.table }}{% endif %}

{% if c.changes %} {% if c.action != "created" %}{% endif %}{% if c.action != "deleted" %}{% endif %} {% for name, change in c.changes.items() %} {% if c.action != "created" %}{% endif %} {% if c.action != "deleted" %}{% endif %} {% endfor %}
AttributeOldNew
{{ name }}{{ cell(change.old) }}{{ cell(change.new) }}
{% else %}

No column values loaded

{% endif %} {% endmacro %}