feat: déplacer 'À lire aussi' après les réactions dans la colonne principale

This commit is contained in:
Cedric Abonnel
2026-05-13 01:32:03 +02:00
parent 0a44ab9da2
commit 78d6c656be
7 changed files with 355 additions and 21 deletions
+77
View File
@@ -48,6 +48,10 @@ function adminStatusBadge(array $a, int $now): string
<a class="nav-link <?= $tab === 'site' ? 'active' : '' ?>"
href="/admin/site">Site</a>
</li>
<li class="nav-item">
<a class="nav-link <?= $tab === 'comments' ? 'active' : '' ?>"
href="/admin/comments">Commentaires</a>
</li>
<?php endif; ?>
</ul>
@@ -461,6 +465,79 @@ function adminStatusBadge(array $a, int $now): string
<?php endif; ?>
<!-- ─────────────────────────── COMMENTAIRES ──────────────────────── -->
<?php if ($tab === 'comments' && isAdmin()): ?>
<h5 class="mb-3">Commentaires</h5>
<?php if (empty($adminData['comments'])): ?>
<p class="text-muted">Aucun commentaire pour l'instant.</p>
<?php else: ?>
<div class="table-responsive">
<table class="table table-sm table-hover align-middle">
<thead>
<tr>
<th>Article</th>
<th>Auteur</th>
<th>Commentaire</th>
<th>Date</th>
<th>État</th>
<th></th>
</tr>
</thead>
<tbody>
<?php foreach ($adminData['comments'] as $c): ?>
<?php
$cSlug = $adminData['articleSlugs'][$c['article_uuid']] ?? null;
$cDate = date('d/m/Y H:i', strtotime((string)$c['created_at']));
$cVerif = $c['verified'] ? '<span class="badge bg-success">Vérifié</span>' : '<span class="badge bg-warning text-dark">En attente</span>';
$cPub = $c['published'] ? '<span class="badge bg-primary">Publié</span>' : '<span class="badge bg-secondary">Masqué</span>';
?>
<tr>
<td class="small">
<?php if ($cSlug): ?>
<a href="/post/<?= rawurlencode($cSlug) ?>#comments"><?= htmlspecialchars($cSlug) ?></a>
<?php else: ?>
<span class="text-muted"><?= htmlspecialchars(substr($c['article_uuid'], 0, 8)) ?>…</span>
<?php endif; ?>
</td>
<td class="small">
<div><?= htmlspecialchars($c['author_name']) ?></div>
<div class="text-muted"><?= htmlspecialchars($c['author_email']) ?></div>
</td>
<td class="small" style="max-width:30ch">
<span title="<?= htmlspecialchars($c['content']) ?>">
<?= htmlspecialchars(mb_strimwidth($c['content'], 0, 80, '…')) ?>
</span>
<?php if (!empty($c['verification_code'])): ?>
<br><span class="text-muted">Code : <?= htmlspecialchars($c['verification_code']) ?></span>
<?php endif; ?>
</td>
<td class="text-muted small text-nowrap"><?= htmlspecialchars($cDate) ?></td>
<td><?= $cVerif ?> <?= $cPub ?></td>
<td>
<?php if ($c['verified'] && $c['published']): ?>
<form method="post" action="/comment-moderate" class="d-inline">
<input type="hidden" name="id" value="<?= (int)$c['id'] ?>">
<input type="hidden" name="pub" value="0">
<button type="submit" class="btn btn-sm btn-outline-danger">Masquer</button>
</form>
<?php elseif ($c['verified'] && !$c['published']): ?>
<form method="post" action="/comment-moderate" class="d-inline">
<input type="hidden" name="id" value="<?= (int)$c['id'] ?>">
<input type="hidden" name="pub" value="1">
<button type="submit" class="btn btn-sm btn-outline-success">Publier</button>
</form>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<?php endif; ?>
<?php endif; ?>
<?php
$content = ob_get_clean();
$title = 'Administration — ' . siteTitle();