{% extends "base.html" %} {% from "macros.html" import icon, btn, badge %} {% block title %}{{ model_label }}{% endblock %} {% block content %} {% if list_chart %}
{{ icon('chart', 14) }} {{ t('Activity Trend') }}
{{ total }} {{ t('records') }}
{% endif %}
{# Toolbar (Airy) #}
{{ icon('search', 16) }}
{% if filters %}
{% endif %}
{# Bulk Action Bar #}
0 {{ t('selected') }}
{% for act in bulk_actions %}
{{ request.csrf_input() }}
{% endfor %}
{# Table Partial Wrapper #} {% block model_table %}
{% if items %}
{# Show the actions column whenever there is any per-row action — including "View", so read-only models (can_edit/can_delete false) still expose the detail icon like every other table. #} {% set has_actions = can_edit or can_delete or user_can_view %} {% for s in sort_links %} {{ s.col }}{% if s.arrow %} {{ s.arrow }}{% endif %} {% endfor %} {% if has_actions %} {% endif %} {% for row in items %} {% for col in columns %} {# Epoch-int timestamp columns (last_seen, revoked_at, ...) are formatted as dates; other columns keep the plain date/passthrough filter. The filter must stay top-level in {{ }} (it is not supported inside {% set %}). #} {% set is_ts_col = col.endswith('_at') or col.endswith('_seen') %} {% if loop.first %} {# Read-only models (can_edit=False) link to the detail view, not the edit form — no point routing to a page that 403s on save. #} {% if is_ts_col %}{{ row[col] | epoch }}{% else %}{{ row[col] | date }}{% endif %} {% else %} {% if is_ts_col %}{{ row[col] | epoch }}{% else %}{{ row[col] | date }}{% endif %} {% endif %} {% endfor %} {% if has_actions %} {% endif %} {% endfor %}
{{ t('ACTIONS') }}
{% if is_auth_model and row.id != request.user.id and not trash %}
{{ request.csrf_input() }}
{% endif %} {# View button - always show if user has view permission #} {% if user_can_view and not trash %} {{ icon('search', 16) }} {% endif %} {# Edit button - only show if model and user allow edit #} {% if can_edit and user_can_edit and not trash %} {{ icon('edit', 16) }} {% endif %} {% if trash %}
{{ request.csrf_input() }}
{% if user_can_delete %}
{{ request.csrf_input() }}
{% endif %} {# Delete button - only show if model and user allow delete #} {% elif can_delete and user_can_delete %}
{{ request.csrf_input() }}
{% endif %}
{% else %}
{{ icon('table', 28, 'empty-icon') }}

{{ t('No records found') }}

{% if q %}{{ t('Try a different search term or filter.') }} {% else %}{{ t('Get started by adding your first record.') }}{% endif %}

{% if can_add and not trash %} {{ icon('plus', 16) }} {{ t('Add first record') }} {% endif %}
{% endif %}
{% endblock %}
{% endblock %}