some simple UI to make it work

This commit is contained in:
Priec
2026-05-17 17:46:04 +02:00
parent 0a36e8839c
commit 1d51a23bfb
10 changed files with 333 additions and 148 deletions

View File

@@ -3,34 +3,61 @@
{% block title %}Blog Articles{% endblock title %}
{% block content %}
<h1>Blog Articles</h1>
<p><a href="/admin/blog/articles/new">New article</a></p>
<div class="space-y-2">
<div class="flex flex-wrap items-center justify-between gap-3">
<div>
<h1 class="text-2xl font-bold">Blog Articles</h1>
<p class="text-sm opacity-70">Create, edit, and remove blog posts.</p>
</div>
<a href="/admin/blog/articles/new" class="btn btn-neutral btn-sm">New article</a>
</div>
{% if articles | length > 0 %}
<table>
<thead>
<tr>
<th>Title</th>
<th>Status</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
{% for article in articles %}
<tr>
<td>{{ article.title }}</td>
<td>{% if article.published %}Published{% else %}Draft{% endif %}</td>
<td>
<a href="/admin/blog/articles/{{ article.id }}/edit">Edit</a>
<form method="post" action="/admin/blog/articles/{{ article.id }}/delete">
<button type="submit">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No articles yet.</p>
{% endif %}
<div class="card border border-base-300 bg-base-100 shadow-sm">
<div class="card-body">
{% if articles | length > 0 %}
<div class="overflow-x-auto">
<table class="table">
<thead>
<tr>
<th>Title</th>
<th>Status</th>
<th class="text-right">Actions</th>
</tr>
</thead>
<tbody>
{% for article in articles %}
<tr>
<td class="font-medium">{{ article.title }}</td>
<td>
{% if article.published %}
<span class="badge">Published</span>
{% else %}
<span class="badge opacity-70">Draft</span>
{% endif %}
</td>
<td>
<div class="flex gap-2">
<a href="/admin/blog/articles/{{ article.id }}/edit" class="btn btn-ghost btn-sm">Edit</a>
<form method="post" action="/admin/blog/articles/{{ article.id }}/delete">
<button type="submit" class="btn btn-ghost btn-sm">Delete</button>
</form>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="text-center">
<p class="font-medium">No articles yet.</p>
<p class="text-sm opacity-70">Create the first blog post.</p>
<div class="pt-2">
<a href="/admin/blog/articles/new" class="btn btn-neutral btn-sm">New article</a>
</div>
</div>
{% endif %}
</div>
</div>
</div>
{% endblock content %}