feat: brouillons visibles uniquement par auteur + ribbon 45deg BROUILLON
This commit is contained in:
@@ -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
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user