Files
simpleblog/templates/admin/dashboard.html
T
2026-11-14 17:05:01 +00:00

62 lines
2.2 KiB
HTML

{% extends "admin/base.html" %}
{% block admin_content %}
<div class="admin-panel">
<h1>Dashboard</h1>
<div style="display:grid;grid-template-columns:repeat(auto-fit,minmax(160px,1fr));gap:20px;margin:24px 0;">
<div class="admin-stat"><span class="num">{{ count }}</span><span class="label">Total posts</span></div>
<div class="admin-stat"><span class="num">{{ published }}</span><span class="label">Published</span></div>
<div class="admin-stat"><span class="num">{{ drafts }}</span><span class="label">Drafts</span></div>
<a class="admin-stat" href="{{ url_for('admin.comments') }}" style="text-decoration:none;">
<span class="num">{{ pending_comments }}</span><span class="label">Awaiting moderation</span>
</a>
</div>
</div>
<div class="admin-panel">
<h2>Recent posts</h2>
<table class="admin-table">
<thead>
<tr>
<th>Title</th>
<th>Status</th>
<th>Date</th>
</tr>
</thead>
<tbody>
{% for p in posts[:5] %}
<tr>
<td><a href="{{ url_for('admin.post_edit', pid=p.id) }}">{{ p.title }}</a></td>
<td>{% if p.status == 'published' %}<span class="term">Published</span>{% else %}Draft{% endif %}</td>
<td>{{ parse_date(p.created_at) }}</td>
</tr>
{% else %}
<tr><td colspan="3" class="empty-state">No posts yet.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
<div class="admin-panel">
<h2>Comments awaiting moderation</h2>
{% if pending %}
<table class="admin-table">
<thead>
<tr><th>Author</th><th>Comment</th><th>Received</th><th></th></tr>
</thead>
<tbody>
{% for c in pending %}
<tr>
<td>{{ c.author }}</td>
<td>{{ c.body[:120] }}{% if c.body|length > 120 %}…{% endif %}</td>
<td>{{ parse_date(c.created_at) }}</td>
<td><a class="btn" href="{{ url_for('admin.comments') }}">Review</a></td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p class="empty-state">Nothing waiting for moderation.</p>
{% endif %}
</div>
{% endblock %}