feat: brouillons visibles uniquement par auteur + ribbon 45deg BROUILLON

This commit is contained in:
Cedric Abonnel
2026-05-08 22:53:43 +02:00
parent a36d7ede76
commit 201ae53e65
58 changed files with 99 additions and 65 deletions
+18 -7
View File
@@ -207,13 +207,24 @@ a:hover {
border-color: var(--vl-border) !important;
}
/* Indicateur brouillon discret */
.badge.bg-warning {
background-color: #fef3c7 !important;
color: #92400e !important;
font-weight: 500;
font-size: 0.7rem;
border-radius: 0.375rem;
/* ─── Ribbon brouillon ───────────────────── */
.draft-ribbon {
position: absolute;
top: 26px;
right: -34px;
width: 130px;
text-align: center;
background: #f59e0b;
color: #fff;
font-size: 0.6rem;
font-weight: 700;
letter-spacing: 0.1em;
text-transform: uppercase;
padding: 5px 0;
transform: rotate(45deg);
pointer-events: none;
z-index: 2;
box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
/* ─── Buttons ─────────────────────────────── */
+21 -1
View File
@@ -68,6 +68,18 @@ switch ($action) {
exit;
}
if (!$article['published']) {
$author = $article['author'] ?? '';
$currentEmail = currentUserEmail() ?? '';
$canView = ($author !== '' && $currentEmail === $author)
|| ($author === '' && isAdmin());
if (!$canView) {
http_response_code(404);
echo 'Article introuvable.';
exit;
}
}
$files = $articles->getFiles($article['uuid']);
// Résout les chemins de fichiers relatifs dans le contenu
@@ -157,7 +169,15 @@ switch ($action) {
case 'list':
default:
$posts = $articles->getAll();
$currentEmail = currentUserEmail() ?? '';
$posts = array_values(array_filter($articles->getAll(), static function (array $a) use ($currentEmail): bool {
if ($a['published']) {
return true;
}
$author = $a['author'] ?? '';
return ($author !== '' && $currentEmail === $author)
|| ($author === '' && isAdmin());
}));
include BASE_PATH . '/templates/post_list.php';
break;
}