{% 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() %}
{{ e.content.model }}{{ 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 %}
| Attribute | {% if c.action != "created" %}Old | {% endif %}{% if c.action != "deleted" %}New | {% endif %}
|---|---|---|
{{ name }} |
{% if c.action != "created" %}{{ cell(change.old) }} | {% endif %} {% if c.action != "deleted" %}{{ cell(change.new) }} | {% endif %}
No column values loaded
{% endif %} {% endmacro %}