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

100 lines
4.9 KiB
HTML

{% extends "admin/base.html" %}
{% block admin_content %}
<div class="admin-panel">
<h1>Comments</h1>
<div class="comment-stats">
<span class="term {% if counts.pending > 0 %}warn{% endif %}">{{ counts.pending }} pending</span>
<span>{{ counts.approved }} approved</span>
<span>{{ counts.rejected }} rejected</span>
<span>{{ counts.spam }} spam</span>
</div>
{% if comments or rejected or spam %}
{% if comments %}
<h2>Pending moderation</h2>
<div class="comment-mod-list">
{% for c in comments %}
<div class="comment-block comment-pending">
<div class="comment-meta">
<span class="comment-author">{{ c.author }}</span>
{% if c.email %}<span class="comment-email">{{ c.email }}</span>{% endif %}
<time datetime="{{ c.created_at }}">{{ parse_date(c.created_at) }}</time>
</div>
<div class="comment-body">{{ render_markdown(c.body) }}</div>
<div class="comment-actions">
<form method="post" action="{{ url_for('admin.comment_approve', cid=c.id) }}" style="display:inline;">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="btn btn-sm btn-success" type="submit">Approve</button>
</form>
<form method="post" action="{{ url_for('admin.comment_reject', cid=c.id) }}" style="display:inline;">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="btn btn-sm" type="submit">Reject</button>
</form>
<form method="post" action="{{ url_for('admin.comment_spam', cid=c.id) }}" style="display:inline;">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="btn btn-sm btn-warning" type="submit">Spam</button>
</form>
<form method="post" action="{{ url_for('admin.comment_delete', cid=c.id) }}" style="display:inline;" onsubmit="return confirm('Delete this comment permanently?');">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="btn btn-sm btn-danger" type="submit">Delete</button>
</form>
</div>
</div>
{% endfor %}
</div>
{% endif %}
{% if rejected %}
<h2>Rejected comments</h2>
<div class="comment-mod-list">
{% for c in rejected %}
<div class="comment-block comment-rejected">
<div class="comment-meta">
<span class="comment-author">{{ c.author }}</span>
{% if c.email %}<span class="comment-email">{{ c.email }}</span>{% endif %}
<time datetime="{{ c.created_at }}">{{ parse_date(c.created_at) }}</time>
</div>
<div class="comment-body">{{ render_markdown(c.body) }}</div>
<div class="comment-actions">
<form method="post" action="{{ url_for('admin.comment_unreject', cid=c.id) }}" style="display:inline;">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="btn btn-sm btn-success" type="submit">Un-reject</button>
</form>
<form method="post" action="{{ url_for('admin.comment_delete', cid=c.id) }}" style="display:inline;" onsubmit="return confirm('Delete this comment permanently?');">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="btn btn-sm btn-danger" type="submit">Delete</button>
</form>
</div>
</div>
{% endfor %}
</div>
{% endif %}
{% if spam %}
<h2>Spam comments</h2>
<div class="comment-mod-list">
{% for c in spam %}
<div class="comment-block comment-spam">
<div class="comment-meta">
<span class="comment-author">{{ c.author }}</span>
{% if c.email %}<span class="comment-email">{{ c.email }}</span>{% endif %}
<time datetime="{{ c.created_at }}">{{ parse_date(c.created_at) }}</time>
</div>
<div class="comment-body">{{ render_markdown(c.body) }}</div>
<div class="comment-actions">
<form method="post" action="{{ url_for('admin.comment_delete', cid=c.id) }}" style="display:inline;" onsubmit="return confirm('Delete this comment permanently?');">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="btn btn-sm btn-danger" type="submit">Delete</button>
</form>
</div>
</div>
{% endfor %}
</div>
{% endif %}
{% else %}
<p class="empty-state">No comments awaiting moderation.</p>
{% endif %}
</div>
{% endblock %}