mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
css: deduplicate html/body reset; fix pages-edit.php invalid HTML
Move the repeated 'html, body { margin:0; padding:0; height:100% }' block from
main.css, search.css, tfe.css, and apropos.css into the single canonical location
in common.css. All four public page stylesheets already load common.css first, so
the rule applies identically — no visual change.
Fix pages-edit.php invalid HTML: the EasyMDE <link rel=stylesheet> was placed
inside <body> (after head.php was already closed), which is invalid. Add an
$extraCss hook to templates/admin/head.php so pages can inject <link> tags into
<head> via an array variable, matching the pattern already used by the public
templates/public/head.php. Also add a symmetric $extraJs hook to
templates/admin/footer.php for future use. pages-edit.php now sets
$extraCss = ['easymde.min.css'] before requiring head.php; the EasyMDE JS
<script> and its inline init remain in <body> in the correct load order.
This commit is contained in:
4
TODO.md
4
TODO.md
@@ -474,7 +474,7 @@ Goal: rename the tables and column to the canonical M2M pattern (`tags`, `thesis
|
|||||||
|
|
||||||
### E — CSS architecture
|
### E — CSS architecture
|
||||||
|
|
||||||
- [ ] **`html, body { margin:0; padding:0; height:100% }` repeated in 4 page stylesheets** —
|
- [x] **`html, body { margin:0; padding:0; height:100% }` repeated in 4 page stylesheets** —
|
||||||
`main.css`, `search.css`, `tfe.css`, `apropos.css` all open with this identical block.
|
`main.css`, `search.css`, `tfe.css`, `apropos.css` all open with this identical block.
|
||||||
Move it to `common.css` once; delete from the four files. Same for the body-level flex-column
|
Move it to `common.css` once; delete from the four files. Same for the body-level flex-column
|
||||||
shell (`display:flex; flex-direction:column; background:var(--white)`) which only differs in
|
shell (`display:flex; flex-direction:column; background:var(--white)`) which only differs in
|
||||||
@@ -882,7 +882,7 @@ Once the above is applied, the following classes become deletable (element name
|
|||||||
|
|
||||||
### XV — `public/admin/pages-edit.php`
|
### XV — `public/admin/pages-edit.php`
|
||||||
|
|
||||||
- [ ] **`<link rel="stylesheet">` injected after `<main>` opens** — the EasyMDE stylesheet CDN
|
- [x] **`<link rel="stylesheet">` injected after `<main>` opens** — the EasyMDE stylesheet CDN
|
||||||
link is placed after the `</head>` has already closed (after `head.php` is included). It
|
link is placed after the `</head>` has already closed (after `head.php` is included). It
|
||||||
sits directly inside `<body>` before `<main>`. This is invalid HTML — `<link>` is a head
|
sits directly inside `<body>` before `<main>`. This is invalid HTML — `<link>` is a head
|
||||||
element. Move it into the `<head>` by passing it to the head template via a `$extraCss`
|
element. Move it into the `<head>` by passing it to the head template via a `$extraCss`
|
||||||
|
|||||||
@@ -28,11 +28,10 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pageTitle = "Éditer : " . htmlspecialchars($page['title']);
|
$pageTitle = "Éditer : " . htmlspecialchars($page['title']);
|
||||||
|
$extraCss = ['https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.css'];
|
||||||
?>
|
?>
|
||||||
<?php require_once APP_ROOT . '/templates/admin/head.php'; ?>
|
<?php require_once APP_ROOT . '/templates/admin/head.php'; ?>
|
||||||
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/easymde/dist/easymde.min.css">
|
|
||||||
|
|
||||||
<main class="admin-main" id="main-content">
|
<main class="admin-main" id="main-content">
|
||||||
<h1 class="admin-page-title">Éditer : <?= htmlspecialchars($page['title']) ?></h1>
|
<h1 class="admin-page-title">Éditer : <?= htmlspecialchars($page['title']) ?></h1>
|
||||||
|
|
||||||
@@ -63,5 +62,4 @@ $pageTitle = "Éditer : " . htmlspecialchars($page['title']);
|
|||||||
toolbarTips: true
|
toolbarTips: true
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<?php require_once APP_ROOT . '/templates/admin/footer.php'; ?>
|
<?php require_once APP_ROOT . '/templates/admin/footer.php'; ?>
|
||||||
|
|||||||
@@ -2,12 +2,6 @@
|
|||||||
À PROPOS PAGE (apropos.php)
|
À PROPOS PAGE (apropos.php)
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
html, body {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.apropos-body {
|
.apropos-body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -24,9 +24,14 @@
|
|||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html,
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
|
||||||
"Helvetica Neue", Arial, sans-serif;
|
"Helvetica Neue", Arial, sans-serif;
|
||||||
background: var(--white);
|
background: var(--white);
|
||||||
|
|||||||
@@ -2,12 +2,6 @@
|
|||||||
HOME PAGE (index.php)
|
HOME PAGE (index.php)
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
html, body {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.home-body {
|
.home-body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -2,12 +2,6 @@
|
|||||||
RÉPERTOIRE / SEARCH PAGE (search.php)
|
RÉPERTOIRE / SEARCH PAGE (search.php)
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
html, body {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-body {
|
.search-body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -2,12 +2,6 @@
|
|||||||
TFE INDIVIDUAL PAGE (tfe.php)
|
TFE INDIVIDUAL PAGE (tfe.php)
|
||||||
============================================================ */
|
============================================================ */
|
||||||
|
|
||||||
html, body {
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tfe-body {
|
.tfe-body {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
|||||||
@@ -1,2 +1,5 @@
|
|||||||
|
<?php foreach ($extraJs ?? [] as $js): ?>
|
||||||
|
<script src="<?= htmlspecialchars($js) ?>"></script>
|
||||||
|
<?php endforeach; ?>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
<link rel="icon" type="image/svg+xml" href="/assets/admin_favicon.svg">
|
<link rel="icon" type="image/svg+xml" href="/assets/admin_favicon.svg">
|
||||||
<link rel="stylesheet" href="/assets/modern-normalize.min.css">
|
<link rel="stylesheet" href="/assets/modern-normalize.min.css">
|
||||||
<link rel="stylesheet" href="/assets/admin.css">
|
<link rel="stylesheet" href="/assets/admin.css">
|
||||||
|
<?php foreach ($extraCss ?? [] as $css): ?>
|
||||||
|
<link rel="stylesheet" href="<?= htmlspecialchars($css) ?>">
|
||||||
|
<?php endforeach; ?>
|
||||||
<?php if (php_sapi_name() === 'cli-server'): ?>
|
<?php if (php_sapi_name() === 'cli-server'): ?>
|
||||||
<script>
|
<script>
|
||||||
(function poll(){
|
(function poll(){
|
||||||
|
|||||||
Reference in New Issue
Block a user