style: liste éditoriale, navbar avec tagline, footer 2 colonnes

This commit is contained in:
Cedric Abonnel
2026-05-08 13:43:40 +02:00
parent 6ba1c18764
commit 0bf9213713
4 changed files with 196 additions and 34 deletions
+20 -30
View File
@@ -5,42 +5,32 @@ $Parsedown = new Parsedown();
ob_start();
?>
<h1 class="mb-4 text-center">📝 Tous les posts</h1>
<div class="row row-cols-1 row-cols-md-2 g-4">
<div class="posts-list">
<?php foreach ($posts as $post): ?>
<div class="col">
<div class="card shadow-sm h-100 border-<?php echo $post['is_published'] ? 'primary' : 'warning'; ?>">
<div class="card-body d-flex flex-column">
<h5 class="card-title text-primary">
<?= htmlspecialchars($post['title']) ?>
<?php if (!$post['is_published']): ?>
<span class="badge bg-warning text-dark ms-2">⏳ Brouillon</span>
<?php endif; ?>
</h5>
<div class="card-text text-body">
<?php
$html = $Parsedown->text($post['content']);
$preview = mb_strimwidth(strip_tags($html), 0, 300, '…');
echo '<p>' . $preview . '</p>';
<?php
$html = $Parsedown->text($post['content']);
$preview = mb_strimwidth(strip_tags($html), 0, 240, '…');
?>
</div>
<p class="text-muted small mt-auto mb-2">📅 Publié le <?= date('d/m/Y', strtotime($post['created_at'])) ?></p>
<div class="d-flex justify-content-end gap-2">
<a href="route.php?action=view&id=<?= $post['id'] ?>" class="btn btn-sm btn-outline-primary">🔍 Voir</a>
<a href="route.php?action=edit&id=<?= $post['id'] ?>" class="btn btn-sm btn-outline-secondary">✏️ Modifier</a>
</div>
<a href="route.php?action=view&id=<?= $post['id'] ?>" class="stretched-link"></a>
</div>
<article class="post-entry">
<h2 class="post-entry-title">
<a href="route.php?action=view&id=<?= $post['id'] ?>">
<?= htmlspecialchars($post['title']) ?>
</a>
<?php if (!$post['is_published']): ?>
<span class="badge bg-warning ms-2">Brouillon</span>
<?php endif; ?>
</h2>
<p class="post-entry-excerpt"><?= htmlspecialchars($preview) ?></p>
<div class="post-entry-meta">
<span><?= date('d/m/Y', strtotime($post['created_at'])) ?></span>
<a href="route.php?action=edit&id=<?= $post['id'] ?>" class="post-entry-edit">modifier</a>
<a href="route.php?action=view&id=<?= $post['id'] ?>" class="post-entry-read">→ lire</a>
</div>
</div>
</article>
<?php endforeach; ?>
</div>
<?php
$content = ob_get_clean();
$title = 'Liste des posts';
$title = 'varlog';
include __DIR__ . '/layout.php';