feat: déplacer 'À lire aussi' après les réactions dans la colonne principale
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -44,6 +44,31 @@ $_SESSION['comment_csrf'] = $_csrfToken;
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if (!empty($alsoReadArticles ?? [])): ?>
|
||||
<!-- ── À lire aussi ──────────────────────────────────────────────── -->
|
||||
<div class="also-read mb-4">
|
||||
<h6 class="also-read-title">À lire aussi</h6>
|
||||
<div class="also-read-grid">
|
||||
<?php foreach ($alsoReadArticles as $_also):
|
||||
$_alsoCover = $_also['cover'] ?? '';
|
||||
$_alsoCat = trim($_also['category'] ?? '');
|
||||
$_alsoGradient = coverGradient($_alsoCat !== '' ? $_alsoCat : $_also['uuid'], $allCats ?? []);
|
||||
$_alsoDate = date('d/m/Y', strtotime((string)($_also['published_at'] ?? $_also['created_at'] ?? '')));
|
||||
?>
|
||||
<a href="/post/<?= rawurlencode($_also['slug'] ?? '') ?>" class="related-card">
|
||||
<div class="related-card-thumb" style="<?= $_alsoCover !== ''
|
||||
? 'background-image:url(/file?uuid=' . rawurlencode($_also['uuid']) . '&name=' . rawurlencode($_alsoCover) . ');background-size:cover;background-position:center'
|
||||
: 'background:' . htmlspecialchars($_alsoGradient) ?>"></div>
|
||||
<div class="related-card-body">
|
||||
<div class="related-card-title"><?= htmlspecialchars($_also['title']) ?></div>
|
||||
<div class="related-card-date"><?= $_alsoDate ?></div>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<!-- ── Commentaires ───────────────────────────────────────────────── -->
|
||||
<div id="comments" class="mb-4">
|
||||
|
||||
|
||||
@@ -131,6 +131,9 @@ $_layoutCurrentCat = trim($_GET['cat'] ?? '');
|
||||
<!-- JS -->
|
||||
<script src="/assets/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="/assets/js/app.js"></script>
|
||||
<?php if (isset($reactionStats)): ?>
|
||||
<script src="/assets/js/reactions.js"></script>
|
||||
<?php endif; ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+2
-20
@@ -170,6 +170,8 @@ $hasSources = (!empty($externalLinks) || !empty($files))
|
||||
</p>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php include __DIR__ . '/comments_section.php'; ?>
|
||||
|
||||
</div><!-- /col principale -->
|
||||
|
||||
<div class="post-sidebar-col order-3">
|
||||
@@ -286,26 +288,6 @@ $hasSources = (!empty($externalLinks) || !empty($files))
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if (!empty($alsoReadArticles ?? [])): ?>
|
||||
<h6 class="related-sidebar-title">À lire aussi</h6>
|
||||
<?php foreach ($alsoReadArticles as $_also):
|
||||
$_alsoCover = $_also['cover'] ?? '';
|
||||
$_alsoCat = trim($_also['category'] ?? '');
|
||||
$_alsoGradient = coverGradient($_alsoCat !== '' ? $_alsoCat : $_also['uuid'], $allCats ?? []);
|
||||
$_alsoDate = date('d/m/Y', strtotime((string)($_also['published_at'] ?? $_also['created_at'] ?? '')));
|
||||
?>
|
||||
<a href="/post/<?= rawurlencode($_also['slug'] ?? '') ?>" class="related-card">
|
||||
<div class="related-card-thumb" style="<?= $_alsoCover !== ''
|
||||
? 'background-image:url(/file?uuid=' . rawurlencode($_also['uuid']) . '&name=' . rawurlencode($_alsoCover) . ');background-size:cover;background-position:center'
|
||||
: 'background:' . htmlspecialchars($_alsoGradient) ?>">
|
||||
</div>
|
||||
<div class="related-card-body">
|
||||
<div class="related-card-title"><?= htmlspecialchars($_also['title']) ?></div>
|
||||
<div class="related-card-date"><?= $_alsoDate ?></div>
|
||||
</div>
|
||||
</a>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user