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

43 lines
1.6 KiB
HTML

{% extends "admin/base.html" %}
{% block admin_content %}
<div class="admin-panel">
<h1>Posts</h1>
<div class="admin-actions">
<a class="primary" href="{{ url_for('admin.post_new') }}">+ New post</a>
<a href="{{ url_for('admin.dashboard') }}">Dashboard</a>
</div>
<table class="admin-table">
<thead>
<tr>
<th>Title</th>
<th>Author</th>
<th>Category</th>
<th>Status</th>
<th>Created</th>
<th style="width:130px;">Actions</th>
</tr>
</thead>
<tbody>
{% for p in posts %}
<tr>
<td><a href="{{ url_for('public.post', slug=p.slug) }}">{{ p.title }}</a></td>
<td>{{ p.author }}</td>
<td>{{ p.category }}</td>
<td>{% if p.status == 'published' %}<span class="term">Published</span>{% else %}Draft{% endif %}</td>
<td>{{ parse_date(p.created_at) }}</td>
<td class="table-actions">
<a class="btn" href="{{ url_for('admin.post_edit', pid=p.id) }}">Edit</a>
<form method="post" action="{{ url_for('admin.post_delete', pid=p.id) }}" style="display:inline;" onsubmit="return confirm('Delete this post?');">
<input type="hidden" name="csrf_token" value="{{ csrf_token }}">
<button class="btn btn-danger" type="submit">Delete</button>
</form>
</td>
</tr>
{% else %}
<tr><td colspan="6" class="empty-state">No posts. Create your first post to get started.</td></tr>
{% endfor %}
</tbody>
</table>
</div>
{% endblock %}