an / templates /admin_boards.html
Docfile's picture
Upload 21 files
cb18dab verified
{% extends 'base.html' %}
{% block title %}Gestion des Planches{% endblock %}
{% block content %}
<div class="mb-8 flex justify-between items-center px-4">
<h1 class="text-3xl font-bold text-gray-900">Gestion des Planches</h1>
<a href="{{ url_for('admin_dashboard') }}" class="text-blue-600 hover:underline">Retour au Dashboard</a>
</div>
{% with messages = get_flashed_messages() %}
{% if messages %}
<div class="px-4 mb-4">
{% for message in messages %}
<div class="bg-green-50 text-green-700 border border-green-200 p-3 rounded-lg">{{ message }}</div>
{% endfor %}
</div>
{% endif %}
{% endwith %}
<div class="grid grid-cols-1 md:grid-cols-2 gap-8 px-4">
<!-- Add Board Form -->
<div class="bg-white p-6 rounded-xl border border-gray-100 shadow-sm h-fit">
<h2 class="text-xl font-bold text-gray-900 mb-4">Ajouter une planche</h2>
<form action="{{ url_for('admin_add_board') }}" method="POST" class="space-y-4">
<div>
<label class="block text-gray-700 text-sm font-semibold mb-2" for="slug">Slug (ex: tech)</label>
<input type="text" name="slug" id="slug" required class="w-full bg-gray-50 text-gray-900 border border-gray-200 rounded-lg py-2 px-3 focus:ring-2 focus:ring-blue-500 placeholder-gray-400" placeholder="tech">
</div>
<div>
<label class="block text-gray-700 text-sm font-semibold mb-2" for="name">Nom (ex: Technologie)</label>
<input type="text" name="name" id="name" required class="w-full bg-gray-50 text-gray-900 border border-gray-200 rounded-lg py-2 px-3 focus:ring-2 focus:ring-blue-500 placeholder-gray-400" placeholder="Technologie">
</div>
<div>
<label class="block text-gray-700 text-sm font-semibold mb-2" for="description">Description</label>
<input type="text" name="description" id="description" class="w-full bg-gray-50 text-gray-900 border border-gray-200 rounded-lg py-2 px-3 focus:ring-2 focus:ring-blue-500 placeholder-gray-400" placeholder="Description courte">
</div>
<button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-lg transition-transform active:scale-95">Ajouter</button>
</form>
</div>
<!-- List Boards -->
<div class="bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden">
<table class="min-w-full divide-y divide-gray-200">
<thead class="bg-gray-50">
<tr>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Slug</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Nom</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase">Action</th>
</tr>
</thead>
<tbody class="divide-y divide-gray-200 text-gray-700">
{% for board in boards %}
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 font-mono text-sm text-blue-600">/{{ board.slug }}/</td>
<td class="px-6 py-4 font-medium">{{ board.name }}</td>
<td class="px-6 py-4">
<form action="{{ url_for('admin_delete_board', board_id=board.id) }}" method="POST" onsubmit="return confirm('Supprimer cette planche et TOUS ses posts ?');">
<button type="submit" class="text-red-600 hover:text-red-800 font-bold text-sm">Supprimer</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}