an / templates /admin.html
Docfile's picture
Upload 21 files
cb18dab verified
{% extends 'base.html' %}
{% block title %}Tableau de bord Admin{% endblock %}
{% block content %}
<div class="mb-8 flex justify-between items-center px-4">
<h1 class="text-3xl font-bold text-gray-900">Tableau de bord Admin</h1>
<div class="space-x-2">
<a href="{{ url_for('admin_boards') }}" class="bg-blue-100 hover:bg-blue-200 text-blue-800 px-4 py-2 rounded-lg font-medium">G茅rer les Planches</a>
<a href="{{ url_for('admin_logout') }}" class="bg-gray-200 hover:bg-gray-300 text-gray-700 px-4 py-2 rounded-lg font-medium">D茅connexion</a>
</div>
</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="bg-white rounded-xl border border-gray-200 shadow-sm overflow-hidden mx-4">
<div class="overflow-x-auto">
<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 tracking-wider">ID</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Type</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Board</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Contenu/Fichier</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">IP</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Date</th>
<th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Action</th>
</tr>
</thead>
<tbody class="bg-white divide-y divide-gray-200 text-gray-700">
{% for post in posts %}
<tr class="hover:bg-gray-50">
<td class="px-6 py-4 whitespace-nowrap">
<a href="{{ url_for('thread', thread_id=post.thread_id if post.thread_id else post.id) }}#post-{{ post.id }}" target="_blank" class="text-blue-600 hover:underline font-medium">
{{ post.id }}
</a>
</td>
<td class="px-6 py-4 whitespace-nowrap">
{% if post.thread_id %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-gray-100 text-gray-800">R茅ponse</span>
{% else %}
<span class="inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">Fil</span>
{% endif %}
</td>
<td class="px-6 py-4 whitespace-nowrap">
/{{ post.board.slug }}/
</td>
<td class="px-6 py-4">
<div class="max-w-xs truncate text-xs">
{{ post.content|default('', true) }}
{% if post.filename %}
<br>
<span class="text-blue-500">[Fichier : {{ post.original_filename }}]</span>
{% endif %}
</div>
</td>
<td class="px-6 py-4 whitespace-nowrap text-xs">
{{ post.ip_address }}
</td>
<td class="px-6 py-4 whitespace-nowrap text-xs">
{{ post.created_at.strftime('%Y-%m-%d %H:%M') }}
</td>
<td class="px-6 py-4 whitespace-nowrap">
<div class="flex space-x-2">
<form action="{{ url_for('delete_post', post_id=post.id) }}" method="POST" onsubmit="return confirm('脢tes-vous s没r de vouloir supprimer ce post ?');">
<button type="submit" class="text-red-600 hover:text-red-800 font-bold text-sm">Supprimer</button>
</form>
<form action="{{ url_for('ban_ip', post_id=post.id) }}" method="POST" onsubmit="return confirm('脢tes-vous s没r de vouloir BANNIR cette IP ?');">
<button type="submit" class="text-orange-600 hover:text-orange-800 font-bold text-sm">Bannir IP</button>
</form>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endblock %}