Simplified
This commit is contained in:
@@ -3,28 +3,49 @@
|
||||
{% block title %}Admin – Gestion des articles{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<h2>Gestion des articles</h2>
|
||||
<h2>Gestion des articles</h2>
|
||||
|
||||
<!-- Lien d’ajout -->
|
||||
<a href="/admin/edit/0">+ Ajouter un article</a>
|
||||
<!-- Lien d'ajout -->
|
||||
<p>
|
||||
<a href="/admin/edit/0" class="btn btn-primary">+ Ajouter un article</a>
|
||||
</p>
|
||||
|
||||
{% for post in posts %}
|
||||
<div class="post">
|
||||
<h3>{{ post.title }}</h3>
|
||||
<p>{{ post.content|raw }}</p>
|
||||
|
||||
<div class="admin-actions">
|
||||
<a href="/admin/edit/{{ post.id }}">Éditer</a>
|
||||
{% if posts is not empty %}
|
||||
<table class="admin-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Titre</th>
|
||||
<th>Créé le</th>
|
||||
<th>Modifié le</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for post in posts %}
|
||||
<tr>
|
||||
<td>
|
||||
<strong>{{ post.title }}</strong>
|
||||
{% if post.isRecent(7) %}
|
||||
<span class="badge badge-new">Nouveau</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{ post.createdAt|date("d/m/Y H:i") }}</td>
|
||||
<td>{{ post.updatedAt|date("d/m/Y H:i") }}</td>
|
||||
<td class="admin-actions">
|
||||
<a href="/admin/edit/{{ post.id }}" class="btn btn-sm btn-secondary">Éditer</a>
|
||||
|
||||
<form method="post" action="/admin/delete/{{ post.id }}" style="display:inline;">
|
||||
<button type="submit"
|
||||
onclick="return confirm('Supprimer cet article ?')">
|
||||
<button type="submit" class="btn btn-sm btn-danger"
|
||||
onclick="return confirm('Supprimer cet article ?')">
|
||||
Supprimer
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% else %}
|
||||
<p>Aucun article à gérer.</p>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% else %}
|
||||
<p><em>Aucun article à gérer.</em></p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user