Files
JQC_features/templates/admin/audit.html
T

75 lines
2.6 KiB
HTML

{% extends "admin/base.html" %}
{% block title %}Audit log{% endblock %}
{% block content %}
<header class="page-head">
<div>
<h1>Audit log</h1>
<p class="muted">Every content change, newest first. Times are UTC.</p>
</div>
<a class="btn btn--ghost" href="{{ url_for('admin.dashboard') }}">← Dashboard</a>
</header>
<div class="filters">
<span class="filters__label">Filter</span>
{% set actions = [('', 'All actions'), ('create','create'), ('update','update'), ('delete','delete')] %}
{% for val, label in actions %}
<a class="filter-chip {{ 'is-active' if action == val }}"
href="{{ url_for('admin.audit', action=val, entity=entity) }}">{{ label }}</a>
{% endfor %}
<span class="filters__sep">·</span>
{% set entities = [('', 'All types'), ('section','section'), ('topic','topic')] %}
{% for val, label in entities %}
<a class="filter-chip {{ 'is-active' if entity == val }}"
href="{{ url_for('admin.audit', action=action, entity=val) }}">{{ label }}</a>
{% endfor %}
</div>
{% if entries %}
<div class="table-wrap">
<table class="audit-table">
<thead>
<tr>
<th>When (UTC)</th>
<th>Actor</th>
<th>Action</th>
<th>Type</th>
<th>ID</th>
<th>Detail</th>
</tr>
</thead>
<tbody>
{% for e in entries %}
<tr>
<td class="mono nowrap">{{ e.created_at.strftime('%Y-%m-%d %H:%M:%S') if e.created_at else '—' }}</td>
<td>{{ e.actor or '—' }}</td>
<td><span class="badge badge--{{ e.action }}">{{ e.action }}</span></td>
<td>{{ e.entity }}</td>
<td class="mono">{{ e.entity_id if e.entity_id is not none else '—' }}</td>
<td>{{ e.detail or '' }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% if pagination.pages > 1 %}
<nav class="pager">
{% if pagination.has_prev %}
<a class="btn btn--ghost btn--sm" href="{{ url_for('admin.audit', page=pagination.prev_num, action=action, entity=entity) }}">← Newer</a>
{% else %}
<span class="btn btn--ghost btn--sm is-disabled">← Newer</span>
{% endif %}
<span class="pager__info">Page {{ pagination.page }} of {{ pagination.pages }}</span>
{% if pagination.has_next %}
<a class="btn btn--ghost btn--sm" href="{{ url_for('admin.audit', page=pagination.next_num, action=action, entity=entity) }}">Older →</a>
{% else %}
<span class="btn btn--ghost btn--sm is-disabled">Older →</span>
{% endif %}
</nav>
{% endif %}
{% else %}
<div class="empty">No audit entries{{ ' for this filter' if action or entity }}.</div>
{% endif %}
{% endblock %}