fix template consolidation: admin/head.php wraps public/head.php, footer.php wired to all public pages, remove duplicate font-family and body reset

This commit is contained in:
Pontoporeia
2026-03-31 22:03:15 +02:00
parent 3a42838cec
commit 4ff959a72d
9 changed files with 16 additions and 36 deletions

View File

@@ -12,3 +12,4 @@
- [x] Fix DB routing: local dev (php -S) auto-uses test.db, production (nginx/fpm) uses posterg.db — no env var needed - [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] 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 - [x] Consolidate admin/public templates: shared head.php, admin/nav.php partial, common.css loaded first in admin, removed duplicate a11y CSS
- [x] admin/head.php now includes public/head.php as base (single source of boilerplate); removed duplicate font-family from .admin-body; wired templates/footer.php to all public pages; fixed duplicate body{} in common.css

View File

@@ -96,5 +96,4 @@ $extraCss = ['/assets/css/apropos.css'];
</div> </div>
</main> </main>
</body> <?php include APP_ROOT . '/templates/footer.php'; ?>
</html>

View File

@@ -18,9 +18,7 @@
min-height: 100vh; min-height: 100vh;
background: var(--admin-bg); background: var(--admin-bg);
color: var(--admin-text); color: var(--admin-text);
font-family: /* font-family inherited from common.css body */
-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
Arial, sans-serif;
} }
/* Admin nav (dark version of site-nav) */ /* Admin nav (dark version of site-nav) */

View File

@@ -165,5 +165,4 @@ $extraCss = ['/assets/css/main.css'];
<?php endif; ?> <?php endif; ?>
</main> </main>
</body> <?php include APP_ROOT . '/templates/footer.php'; ?>
</html>

View File

@@ -48,5 +48,4 @@ $extraCss = ['/assets/css/apropos.css'];
</div> </div>
</main> </main>
</body> <?php include APP_ROOT . '/templates/footer.php'; ?>
</html>

View File

@@ -293,5 +293,4 @@ $extraCss = ['/assets/css/search.css'];
</main> </main>
<?php endif; ?> <?php endif; ?>
</body> <?php include APP_ROOT . '/templates/footer.php'; ?>
</html>

View File

@@ -241,5 +241,4 @@ $extraCss = ['/assets/css/tfe.css'];
</article> </article>
</main> </main>
</body> <?php include APP_ROOT . '/templates/footer.php'; ?>
</html>

View File

@@ -1,26 +1,11 @@
<!DOCTYPE html> <?php
<html lang="fr"> // Admin head: builds on the shared public head.
<head> // Sets admin defaults then delegates to public/head.php for the full <head> block.
<meta charset="UTF-8"> $pageTitle = isset($pageTitle) ? $pageTitle . ' Admin' : 'Admin';
<meta name="viewport" content="width=device-width, initial-scale=1"> $extraCss = array_merge(['/assets/css/admin.css'], $extraCss ?? []);
<title><?= htmlspecialchars($pageTitle ?? 'Admin') ?> Posterg</title> $_adminHead = true; // flag so public/head.php knows to skip OG/meta
<link rel="icon" type="image/svg+xml" href="/assets/admin_favicon.svg"> ?>
<link rel="stylesheet" href="/assets/css/modern-normalize.min.css"> <?php include APP_ROOT . '/templates/public/head.php'; ?>
<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) ?>">
<?php endforeach; ?>
<?php if (php_sapi_name() === 'cli-server'): ?>
<script>
(function poll(){
fetch('/live-reload.php').then(r=>r.json()).then(d=>{
if(d.changed) location.reload(); else setTimeout(poll,1000);
}).catch(()=>setTimeout(poll,2000));
})();
</script>
<?php endif; ?>
</head>
<body class="admin-body"> <body class="admin-body">
<a href="#main-content" class="skip-link">Aller au contenu principal</a> <a href="#main-content" class="skip-link">Aller au contenu principal</a>
<?php include APP_ROOT . '/templates/admin/nav.php'; ?> <?php include APP_ROOT . '/templates/admin/nav.php'; ?>

View File

@@ -4,6 +4,7 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title><?= htmlspecialchars($pageTitle ?? 'Posterg') ?></title> <title><?= htmlspecialchars($pageTitle ?? 'Posterg') ?></title>
<?php if (!empty($_adminHead)) { $ogTags = []; $metaDescription = ''; } ?>
<?php if (!empty($metaDescription)): ?> <?php if (!empty($metaDescription)): ?>
<meta name="description" content="<?= htmlspecialchars($metaDescription) ?>"> <meta name="description" content="<?= htmlspecialchars($metaDescription) ?>">
<?php endif; ?> <?php endif; ?>