{# Versions card — owner + admin only. Renders entity.version_history (oldest-first) reversed so newest appears at top. Each row gets: * version label (vN, "current" badge for the active one) * short hash + size + created_at * Restore button (owner + admin) for non-current versions * Download button (admin only) — links to admin submission bundle Required scope: entity — store_entities row carrying version_no + version_history is_owner — bool is_admin — bool Self-guards on visibility (only renders for owner/admin) and on history length (>= 1). Plain entities created post-v37 always have at least a v1 entry. #} {% if (is_owner or is_admin) and entity and entity.version_history and entity.version_history|length >= 1 %}
| Version | Hash | Size | Created | |
|---|---|---|---|---|
| v{{ v.n }} {% if v.n == entity.version_no %}current{% endif %} | {{ v.hash[:12] if v.hash else '—' }} |
{%- if v.size is not none -%} {%- if v.size < 1024 -%}{{ v.size }} B {%- elif v.size < 1048576 -%}{{ "%.1f"|format(v.size / 1024) }} KB {%- else -%}{{ "%.1f"|format(v.size / 1048576) }} MB {%- endif -%} {%- else -%}—{%- endif -%} | {{ v.created_at[:10] if v.created_at else '' }} | {% if v.n != entity.version_no %} {% endif %} |