Add sidebar TOC, simplify Données Secondaires section

- Rename 'Éditer Données Secondaires' → 'Données Secondaires', remove fieldset wrapper on Mots-clés link
- Create admin-toc.php partial: IntersectionObserver-based sidebar nav
- Include TOC on contenus.php, acces.php, parametres.php
- Add .admin-with-toc flex layout (sidebar + main) and .admin-toc CSS
- Fonts (Ductus, BBB DM Sans): verified loaded via variables.css → common.css import chain
- TOC: move inside <main> as <aside>, content in <article>, fix scrolling
- Lazy load: hx-trigger='load delay:100ms' with spinner (htmx-indicator) for tags/langues
- Inline rename: edit button in Nom cell, HTMX post for rename, validate+ cancel buttons
- Checkbox column: width:1% / fit-content
- Remove per-row merge forms/selects, only bulk merge when ≥2 checkboxes selected
- Remove per-row merge dialogs, keep only bulk merge and delete dialogs
- Add htmx-settling CSS transition for lazy-load fade-in
- Update acces.php/parametres.php: article layout, TOC inside main
- TOC: DOMContentLoaded guard, use <nav>+<a> directly instead of <ul>/<li>
- Section spacing: margin-bottom on sections and fieldsets in admin-main--toc
- Language dedup: GROUP BY LOWER(name) in getAllLanguagesWithCount and searchLanguages
- deduplicateLanguages() merges duplicate names and reassigns thesis_languages
- Sticky bulk-actions: position:sticky;top:0;z-index:10
- Tags toolbar: title left, stat count right (margin-left:auto), search bar under
- Tags count stat updated via hx-swap-oob from fragment
- Remove margin/max-width from .admin-main--toc
- Gap between TOC and article: --space-xs, sticky top: --space-xs
- Main padding: --space-s / --space-m / --space-xl (was --space-l/--space-l/--space-2xl)
- Article padding-top: --space-m
This commit is contained in:
Pontoporeia
2026-05-10 12:52:10 +02:00
parent 396cf19e9f
commit a3ded16915
12 changed files with 492 additions and 473 deletions

View File

@@ -1265,23 +1265,25 @@ class Database
$query = trim($query);
if ($query === '') {
$stmt = $this->pdo->query('
SELECT l.id, UPPER(SUBSTR(l.name,1,1)) || SUBSTR(l.name,2) as name,
SELECT MIN(l.id) as id,
UPPER(SUBSTR(MIN(l.name),1,1)) || SUBSTR(MIN(l.name),2) as name,
COUNT(DISTINCT tl.thesis_id) as thesis_count
FROM languages l
LEFT JOIN thesis_languages tl ON l.id = tl.language_id
GROUP BY l.id
ORDER BY thesis_count DESC, l.name COLLATE NOCASE
GROUP BY LOWER(l.name)
ORDER BY thesis_count DESC, LOWER(MIN(l.name)) COLLATE NOCASE
LIMIT 10
');
} else {
$stmt = $this->pdo->prepare('
SELECT l.id, UPPER(SUBSTR(l.name,1,1)) || SUBSTR(l.name,2) as name,
SELECT MIN(l.id) as id,
UPPER(SUBSTR(MIN(l.name),1,1)) || SUBSTR(MIN(l.name),2) as name,
COUNT(DISTINCT tl.thesis_id) as thesis_count
FROM languages l
LEFT JOIN thesis_languages tl ON l.id = tl.language_id
WHERE LOWER(l.name) LIKE LOWER(?)
GROUP BY l.id
ORDER BY LOWER(l.name) = LOWER(?) DESC, thesis_count DESC, l.name COLLATE NOCASE
GROUP BY LOWER(l.name)
ORDER BY LOWER(MIN(l.name)) = LOWER(?) DESC, thesis_count DESC, LOWER(MIN(l.name)) COLLATE NOCASE
LIMIT 10
');
$stmt->execute([$query . '%', $query]);
@@ -1294,17 +1296,51 @@ class Database
*/
public function getAllLanguagesWithCount(): array
{
// Group by lowercased name to deduplicate, keeping the first id
$stmt = $this->pdo->query('
SELECT l.id, UPPER(SUBSTR(l.name,1,1)) || SUBSTR(l.name,2) as name,
SELECT MIN(l.id) as id,
UPPER(SUBSTR(MIN(l.name),1,1)) || SUBSTR(MIN(l.name),2) as name,
COUNT(DISTINCT tl.thesis_id) as thesis_count
FROM languages l
LEFT JOIN thesis_languages tl ON l.id = tl.language_id
GROUP BY l.id
ORDER BY l.name COLLATE NOCASE
GROUP BY LOWER(l.name)
ORDER BY LOWER(MIN(l.name)) COLLATE NOCASE
');
return $stmt->fetchAll();
}
/**
* Deduplicate languages: merge languages with the same lowercased name.
*/
public function deduplicateLanguages(): void
{
$dupes = $this->pdo->query('
SELECT LOWER(name) as lname, MIN(id) as keep_id
FROM languages
GROUP BY LOWER(name)
HAVING COUNT(*) > 1
')->fetchAll();
foreach ($dupes as $dup) {
$this->pdo->prepare('
INSERT OR IGNORE INTO thesis_languages (language_id, thesis_id)
SELECT ?, thesis_id FROM thesis_languages WHERE language_id IN (
SELECT id FROM languages WHERE LOWER(name) = ? AND id != ?
)
')->execute([$dup['keep_id'], $dup['lname'], $dup['keep_id']]);
$this->pdo->prepare('
DELETE FROM thesis_languages WHERE language_id IN (
SELECT id FROM languages WHERE LOWER(name) = ? AND id != ?
)
')->execute([$dup['lname'], $dup['keep_id']]);
$this->pdo->prepare('
DELETE FROM languages WHERE LOWER(name) = ? AND id != ?
')->execute([$dup['lname'], $dup['keep_id']]);
}
}
/**
* Rename a language. Throws if the new name already exists.
*/