mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
consolidate admin/public templates: common.css base in admin, nav partial, remove duplicate CSS
This commit is contained in:
1
TODO.md
1
TODO.md
@@ -11,3 +11,4 @@
|
||||
- [x] Fix CSV import: imported theses not visible on public site (is_published defaulted to 0, access_type_id never set)
|
||||
- [x] Fix DB routing: local dev (php -S) auto-uses test.db, production (nginx/fpm) uses posterg.db — no env var needed
|
||||
- [x] migrate.sh auto-initialises DB from schema when absent/empty; existing DBs untouched
|
||||
- [x] Consolidate admin/public templates: shared head.php, admin/nav.php partial, common.css loaded first in admin, removed duplicate a11y CSS
|
||||
|
||||
@@ -23,22 +23,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
|
||||
$pageTitle = 'Connexion';
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Connexion – Posterg Admin</title>
|
||||
<link rel="icon" type="image/svg+xml" href="/assets/admin_favicon.svg">
|
||||
<link rel="stylesheet" href="/assets/css/modern-normalize.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/admin.css">
|
||||
</head>
|
||||
<body class="admin-body">
|
||||
<nav class="admin-nav" aria-label="Navigation admin">
|
||||
<a href="/" class="admin-nav__logo" target="_blank" rel="noopener noreferrer">
|
||||
<span aria-hidden="true">← </span>Posterg<span class="sr-only"> (site public, nouvel onglet)</span>
|
||||
</a>
|
||||
</nav>
|
||||
<?php require_once APP_ROOT . '/templates/admin/head.php'; ?>
|
||||
|
||||
<div class="admin-login-wrap">
|
||||
<div class="admin-login-box">
|
||||
@@ -57,5 +42,5 @@ $pageTitle = 'Connexion';
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php require_once APP_ROOT . '/templates/admin/footer.php'; ?>
|
||||
|
||||
@@ -12,12 +12,6 @@
|
||||
--admin-input-bg: transparent;
|
||||
}
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.admin-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
@@ -840,37 +834,7 @@ html, body {
|
||||
ACCESSIBILITY UTILITIES
|
||||
============================================================ */
|
||||
|
||||
/* Consistent keyboard-focus outline for admin interactive elements */
|
||||
/* Admin-specific focus outline colour override */
|
||||
:focus-visible {
|
||||
outline: 2px solid var(--admin-purple);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
/* Skip-to-admin-content link */
|
||||
.skip-link {
|
||||
position: absolute;
|
||||
top: -999px;
|
||||
left: 1rem;
|
||||
z-index: 9999;
|
||||
padding: 0.5rem 1rem;
|
||||
background: var(--admin-purple);
|
||||
color: #fff;
|
||||
font-size: 0.9rem;
|
||||
font-weight: 600;
|
||||
text-decoration: none;
|
||||
border-radius: 0 0 4px 4px;
|
||||
}
|
||||
|
||||
.skip-link:focus {
|
||||
top: 0;
|
||||
}
|
||||
|
||||
/* Respect user motion preferences */
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
transition-duration: 0.01ms !important;
|
||||
animation-duration: 0.01ms !important;
|
||||
}
|
||||
outline-color: var(--admin-purple);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<title><?= htmlspecialchars($pageTitle ?? 'Admin') ?> – Posterg</title>
|
||||
<link rel="icon" type="image/svg+xml" href="/assets/admin_favicon.svg">
|
||||
<link rel="stylesheet" href="/assets/css/modern-normalize.min.css">
|
||||
<link rel="stylesheet" href="/assets/css/common.css">
|
||||
<link rel="stylesheet" href="/assets/css/admin.css">
|
||||
<?php foreach ($extraCss ?? [] as $css): ?>
|
||||
<link rel="stylesheet" href="<?= htmlspecialchars($css) ?>">
|
||||
@@ -22,27 +23,4 @@
|
||||
</head>
|
||||
<body class="admin-body">
|
||||
<a href="#main-content" class="skip-link">Aller au contenu principal</a>
|
||||
<nav class="admin-nav" aria-label="Navigation admin">
|
||||
<a href="/" class="admin-nav__logo" target="_blank" rel="noopener noreferrer">
|
||||
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 256 256" style="vertical-align:middle;margin-right:0.4em"><path d="M208,72H128V32a8,8,0,0,0-13.66-5.66l-96,96a8,8,0,0,0,0,11.32l96,96A8,8,0,0,0,128,224V184h80a16,16,0,0,0,16-16V88A16,16,0,0,0,208,72Zm0,96H120a8,8,0,0,0-8,8v28.69L35.31,128,112,51.31V80a8,8,0,0,0,8,8h88Z"></path></svg>Posterg<span class="sr-only"> (site public, nouvel onglet)</span>
|
||||
</a>
|
||||
<?php
|
||||
$currentPage = basename($_SERVER['PHP_SELF']);
|
||||
$thesisId = $_GET['id'] ?? null;
|
||||
?>
|
||||
<ul class="admin-nav__list">
|
||||
<li><a href="/admin/" <?= $currentPage === 'index.php' ? 'aria-current="page"' : '' ?>>Liste des TFE</a></li>
|
||||
<li><a href="/admin/add.php" <?= $currentPage === 'add.php' ? 'aria-current="page"' : '' ?>>Ajouter un TFE</a></li>
|
||||
<li><a href="/admin/import.php" <?= $currentPage === 'import.php' ? 'aria-current="page"' : '' ?>>Importer une liste de TFE</a></li>
|
||||
<li><a href="/admin/pages.php" <?= in_array($currentPage, ['pages.php','pages-edit.php']) ? 'aria-current="page"' : '' ?>>Pages statiques</a></li>
|
||||
<li><a href="/admin/tags.php" <?= $currentPage === 'tags.php' ? 'aria-current="page"' : '' ?>>Mots-clés</a></li>
|
||||
<li><a href="/admin/system.php" <?= in_array($currentPage, ['system.php','status.php','logs.php']) ? 'aria-current="page"' : '' ?>>Système</a></li>
|
||||
<li><a href="/admin/account.php" <?= $currentPage === 'account.php' ? 'aria-current="page"' : '' ?>>Compte</a></li>
|
||||
<?php if ($thesisId && in_array($currentPage, ['edit.php', 'thanks.php'])): ?>
|
||||
<li><a href="/admin/edit.php?id=<?= intval($thesisId) ?>" <?= $currentPage === 'edit.php' ? 'aria-current="page"' : '' ?>>Modifier</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if (defined('ADMIN_PASSWORD_HASH')): ?>
|
||||
<li class="admin-nav__logout"><a href="/admin/logout.php">Déconnexion</a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</nav>
|
||||
<?php include APP_ROOT . '/templates/admin/nav.php'; ?>
|
||||
|
||||
26
templates/admin/nav.php
Normal file
26
templates/admin/nav.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
// admin/nav.php — admin navigation bar
|
||||
// Reads $pageTitle (set by each page) and $_GET['id'] for context-sensitive edit link.
|
||||
$_adminCurrentPage = basename($_SERVER['PHP_SELF']);
|
||||
$_adminThesisId = $_GET['id'] ?? null;
|
||||
?>
|
||||
<nav class="admin-nav" aria-label="Navigation admin">
|
||||
<a href="/" class="admin-nav__logo" target="_blank" rel="noopener noreferrer">
|
||||
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 256 256" style="vertical-align:middle;margin-right:0.4em"><path d="M208,72H128V32a8,8,0,0,0-13.66-5.66l-96,96a8,8,0,0,0,0,11.32l96,96A8,8,0,0,0,128,224V184h80a16,16,0,0,0,16-16V88A16,16,0,0,0,208,72Zm0,96H120a8,8,0,0,0-8,8v28.69L35.31,128,112,51.31V80a8,8,0,0,0,8,8h88Z"></path></svg>Posterg<span class="sr-only"> (site public, nouvel onglet)</span>
|
||||
</a>
|
||||
<ul class="admin-nav__list">
|
||||
<li><a href="/admin/" <?= $_adminCurrentPage === 'index.php' ? 'aria-current="page"' : '' ?>>Liste des TFE</a></li>
|
||||
<li><a href="/admin/add.php" <?= $_adminCurrentPage === 'add.php' ? 'aria-current="page"' : '' ?>>Ajouter un TFE</a></li>
|
||||
<li><a href="/admin/import.php" <?= $_adminCurrentPage === 'import.php' ? 'aria-current="page"' : '' ?>>Importer une liste de TFE</a></li>
|
||||
<li><a href="/admin/pages.php" <?= in_array($_adminCurrentPage, ['pages.php', 'pages-edit.php']) ? 'aria-current="page"' : '' ?>>Pages statiques</a></li>
|
||||
<li><a href="/admin/tags.php" <?= $_adminCurrentPage === 'tags.php' ? 'aria-current="page"' : '' ?>>Mots-clés</a></li>
|
||||
<li><a href="/admin/system.php" <?= in_array($_adminCurrentPage, ['system.php', 'status.php', 'logs.php']) ? 'aria-current="page"' : '' ?>>Système</a></li>
|
||||
<li><a href="/admin/account.php" <?= $_adminCurrentPage === 'account.php' ? 'aria-current="page"' : '' ?>>Compte</a></li>
|
||||
<?php if ($_adminThesisId && in_array($_adminCurrentPage, ['edit.php', 'thanks.php'])): ?>
|
||||
<li><a href="/admin/edit.php?id=<?= intval($_adminThesisId) ?>" <?= $_adminCurrentPage === 'edit.php' ? 'aria-current="page"' : '' ?>>Modifier</a></li>
|
||||
<?php endif; ?>
|
||||
<?php if (defined('ADMIN_PASSWORD_HASH')): ?>
|
||||
<li class="admin-nav__logout"><a href="/admin/logout.php">Déconnexion</a></li>
|
||||
<?php endif; ?>
|
||||
</ul>
|
||||
</nav>
|
||||
Reference in New Issue
Block a user