From 150b5b1dacacb828cce12b93c8ddf8607d29c1ff Mon Sep 17 00:00:00 2001 From: Pontoporeia Date: Wed, 15 Apr 2026 13:42:36 +0200 Subject: [PATCH] =?UTF-8?q?admin/add:=20add=20=3Fmode=3Dstudent=20toggle?= =?UTF-8?q?=20=E2=80=94=20hides=20admin=20header,=20keeps=20auth?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TODO.md | 7 ++++ public/admin/add.php | 27 ++++++++++++--- public/assets/css/admin.css | 69 +++++++++++++++++++++++++++++++++++++ 3 files changed, 98 insertions(+), 5 deletions(-) diff --git a/TODO.md b/TODO.md index 57e3357..b90679a 100644 --- a/TODO.md +++ b/TODO.md @@ -7,3 +7,10 @@ - [x] Use `
` for danger zones (semantic, with `` instead of `
`) - [x] Update CSS: new `.param-*` classes for flat semantic layout - [x] Exclude parametres sections from generic `.admin-body main > section` card styling via `aria-labelledby` prefix + +## Add TFE: admin/student mode toggle +- [x] Add `?mode=student` query param to same add.php page +- [x] Student mode: no admin header/nav, just the form with a back-link +- [x] Admin mode: full admin header/nav, with "Mode étudiant ↗" toggle link (opens in new tab) +- [x] Auth guard stays the same — still requires admin login +- [x] Add `.student-body`, `.thesis-add-header`, `.mode-toggle`, `.form-footer` CSS diff --git a/public/admin/add.php b/public/admin/add.php index c9546b1..a7c315b 100644 --- a/public/admin/add.php +++ b/public/admin/add.php @@ -8,6 +8,7 @@ if (empty($_SESSION["csrf_token"])) { } $pageTitle = "Ajouter un TFE"; +$studentMode = isset($_GET['mode']) && $_GET['mode'] === 'student'; require_once __DIR__ . '/../../src/ThesisCreateController.php'; @@ -47,11 +48,27 @@ function wasSelected($key, $value) { return $formData[$key] == $value; } ?> - - +
-

Ajouter un TFE

+
+

Ajouter un TFE

+ + Mode étudiant ↗ + + ← Retour admin + +
@@ -135,8 +152,8 @@ function wasSelected($key, $value) { include APP_ROOT . '/templates/partials/form/select-field.php'; ?> -
diff --git a/public/assets/css/admin.css b/public/assets/css/admin.css index 296e4d6..9f8e775 100644 --- a/public/assets/css/admin.css +++ b/public/assets/css/admin.css @@ -1683,3 +1683,72 @@ flex-direction: column; gap: var(--space-3xs); } + +/* ── Student mode & toggle ──────────────────────────────────────────────────── */ +.student-body header { + display: none; +} + +.student-body main { + max-width: 720px; +} + +.thesis-add-header { + display: flex; + align-items: baseline; + justify-content: space-between; + gap: var(--space-m); + margin-bottom: var(--space-m); + border-bottom: 1px solid var(--border-primary); + padding-bottom: var(--space-xs); +} + +.thesis-add-header h1 { + margin: 0; + font-size: var(--step-1); + font-weight: 600; + letter-spacing: 0.06em; + text-transform: uppercase; +} + +.mode-toggle { + font-size: var(--step--1); + color: var(--text-secondary); + text-decoration: none; + white-space: nowrap; + border: 1px solid var(--border-primary); + border-radius: 3px; + padding: var(--space-3xs) var(--space-xs); + transition: color 0.15s, border-color 0.15s; +} + +.mode-toggle:hover { + color: var(--accent-primary); + border-color: var(--accent-primary); +} + +.mode-toggle--back { + color: var(--accent-blue); + border-color: var(--blue-muted-border, var(--border-primary)); +} + +.form-footer { + margin-top: var(--space-l); +} + +.form-footer button { + padding: var(--space-2xs) var(--space-l); + background: var(--accent-primary); + color: var(--accent-foreground); + border: none; + border-radius: 3px; + font-size: var(--step--1); + font-family: inherit; + cursor: pointer; + letter-spacing: 0.04em; + transition: background 0.15s; +} + +.form-footer button:hover { + background: var(--accent-secondary); +}