51 lines
1.5 KiB
Twig
51 lines
1.5 KiB
Twig
{% extends "layout.twig" %}
|
||
|
||
{% block title %}Admin – Gestion des articles{% endblock %}
|
||
|
||
{% block content %}
|
||
<h2>Gestion des articles</h2>
|
||
|
||
<!-- Lien d'ajout -->
|
||
<p>
|
||
<a href="/admin/edit/0" class="btn btn-primary">+ Ajouter un article</a>
|
||
</p>
|
||
|
||
{% 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" class="btn btn-sm btn-danger"
|
||
onclick="return confirm('Supprimer cet article ?')">
|
||
Supprimer
|
||
</button>
|
||
</form>
|
||
</td>
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
{% else %}
|
||
<p><em>Aucun article à gérer.</em></p>
|
||
{% endif %}
|
||
{% endblock %} |