mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 11:09:18 +02:00
admin/add: add ?mode=student toggle — hides admin header, keeps auth
This commit is contained in:
7
TODO.md
7
TODO.md
@@ -7,3 +7,10 @@
|
||||
- [x] Use `<fieldset>` for danger zones (semantic, with `<legend>` instead of `<div>`)
|
||||
- [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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
?>
|
||||
<?php $isAdmin = true; $bodyClass = 'admin-body'; require_once APP_ROOT . '/templates/head.php'; ?>
|
||||
<?php include APP_ROOT . '/templates/header.php'; ?>
|
||||
<?php
|
||||
if ($studentMode) {
|
||||
$bodyClass = 'student-body';
|
||||
require_once APP_ROOT . '/templates/head.php';
|
||||
} else {
|
||||
$isAdmin = true;
|
||||
$bodyClass = 'admin-body';
|
||||
require_once APP_ROOT . '/templates/head.php';
|
||||
include APP_ROOT . '/templates/header.php';
|
||||
}
|
||||
?>
|
||||
|
||||
<main id="main-content">
|
||||
<h1>Ajouter un TFE</h1>
|
||||
<div class="thesis-add-header">
|
||||
<h1>Ajouter un TFE</h1>
|
||||
<?php if (!$studentMode): ?>
|
||||
<a href="?mode=student" class="mode-toggle" target="_blank" rel="noopener">Mode étudiant ↗</a>
|
||||
<?php else: ?>
|
||||
<a href="?mode=admin" class="mode-toggle mode-toggle--back">← Retour admin</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php include APP_ROOT . '/templates/partials/flash-messages.php'; ?>
|
||||
|
||||
@@ -135,8 +152,8 @@ function wasSelected($key, $value) {
|
||||
include APP_ROOT . '/templates/partials/form/select-field.php';
|
||||
?>
|
||||
|
||||
<div class="admin-form-footer">
|
||||
<button type="submit" name="go" class="admin-btn">Soumettre</button>
|
||||
<div class="form-footer">
|
||||
<button type="submit" name="go">Soumettre</button>
|
||||
</div>
|
||||
</form>
|
||||
</main>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user