Files
zero2prod/templates/dashboard/posts/list.html
Alphonse Paix da590fb7c6
All checks were successful
Rust / Test (push) Successful in 6m12s
Rust / Rustfmt (push) Successful in 21s
Rust / Clippy (push) Successful in 1m36s
Rust / Code coverage (push) Successful in 4m55s
Templates update
2025-10-06 02:51:52 +02:00

60 lines
3.4 KiB
HTML

<div class="bg-white rounded-lg shadow-md border border-gray-200">
<div class="p-6 border-b border-gray-200">
<div class="flex flex-col sm:flex-row sm:items-center sm:justify-between">
<div>
<h2 class="text-xl font-semibold text-gray-900 flex items-center">
<svg class="w-5 h-5 text-indigo-600 mr-2"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
<span>Posts ({{ posts_count }})</span>
</h2>
<p class="text-sm text-gray-600 mt-1">View and manage all published posts.</p>
</div>
</div>
</div>
<div id="posts-list">
{% block posts %}
{% if posts.is_empty() %}
<div class="p-8 text-center">
<div class="w-16 h-16 bg-gray-200 rounded-full flex items-center justify-center mx-auto mb-4">
<svg class="w-8 h-8 text-gray-500"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/>
</svg>
</div>
<h3 class="text-lg font-medium text-gray-900 mb-2">No posts to display</h3>
<p class="text-gray-600">Content may have shifted due to recent updates or list is empty.</p>
</div>
{% else %}
<div class="divide-y divide-gray-200 mb-6">
{% for post in posts %}
{% include "dashboard/posts/card.html" %}
{% endfor %}
</div>
{% endif %}
<div class="flex items-center justify-center space-x-2 mb-6">
<button hx-get="/admin/posts?page={{ posts_current_page - 1 }}"
hx-target="#posts-list"
hx-swap="innerHTML"
hx-trigger="click"
class="px-3 py-1 text-sm font-medium text-gray-500 rounded-md hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 {% if posts_current_page <= 1 %}opacity-50 cursor-not-allowed{% endif %}"
{% if posts_current_page <= 1 %}disabled{% endif %}>&lt;</button>
<span class="px-3 py-1 text-sm font-medium text-gray-700 bg-gray-100 rounded-md">Page: {{ posts_current_page }}</span>
<button hx-get="/admin/posts?page={{ posts_current_page + 1 }}"
hx-target="#posts-list"
hx-swap="innerHTML"
hx-trigger="click"
class="px-3 py-1 text-sm font-medium text-gray-500 rounded-md hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 {% if posts_current_page >= posts_max_page %}opacity-50 cursor-not-allowed{% endif %}"
{% if posts_current_page >= posts_max_page %}disabled{% endif %}>&gt;</button>
</div>
{% endblock %}
</div>
</div>