mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Add Mots-clés and Langues management to contenus page
- Add searchLanguages, getAllLanguagesWithCount, renameLanguage, mergeLanguage, deleteLanguage to Database - Create actions/language.php handler with rename/merge/merge_bulk/delete actions - Add merge_bulk action to actions/tag.php - Add Mots-clés section to contenus template with HTMX search, select checkboxes, rename/delete/merge buttons, and multi-select merge toolbar - Add Langues section to contenus template with same pattern - Create contenus-tags-fragment.php and contenus-languages-fragment.php HTMX fragments - Remove form-settings- from flat-fieldset CSS selector so fieldsets in contenus retain border/padding - contenus.php: add 'Gérer les mots-clés' link to /admin/tags.php - contenus.php: add Langues fieldset with HTMX search + table (rename/merge/delete/bulk) - tags.php: add HTMX search bar, checkbox column, bulk merge toolbar - Create tags-fragment.php and contenus-langues-fragment.php for HTMX - Remove tab component and associated CSS - Simplify JS: separate tags/langues-prefixed functions - Fix redirects: tag.php defaults to /admin/tags.php, supports return override - Keep tags.php standalone page and Mots-clés button unchanged
This commit is contained in:
72
app/public/admin/actions/language.php
Normal file
72
app/public/admin/actions/language.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../../../bootstrap.php';
|
||||
require_once __DIR__ . '/../../../src/AdminAuth.php';
|
||||
AdminAuth::requireLogin();
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST'
|
||||
|| !isset($_POST['csrf_token'], $_SESSION['csrf_token'])
|
||||
|| !hash_equals($_SESSION['csrf_token'], $_POST['csrf_token'])) {
|
||||
http_response_code(403);
|
||||
die("Accès refusé.");
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/../../../src/Database.php';
|
||||
require_once __DIR__ . '/../../../src/AdminLogger.php';
|
||||
require_once __DIR__ . '/../../../src/ErrorHandler.php';
|
||||
|
||||
try {
|
||||
$db = new Database();
|
||||
$logger = AdminLogger::make();
|
||||
$action = $_POST['action'] ?? '';
|
||||
|
||||
switch ($action) {
|
||||
case 'rename':
|
||||
$id = filter_var($_POST['language_id'] ?? '', FILTER_VALIDATE_INT);
|
||||
$newName = trim($_POST['new_name'] ?? '');
|
||||
if (!$id || $newName === '') throw new Exception("Paramètres invalides.");
|
||||
$db->renameLanguage($id, $newName);
|
||||
break;
|
||||
|
||||
case 'merge':
|
||||
$sourceId = filter_var($_POST['source_id'] ?? '', FILTER_VALIDATE_INT);
|
||||
$targetId = filter_var($_POST['target_id'] ?? '', FILTER_VALIDATE_INT);
|
||||
if (!$sourceId || !$targetId) throw new Exception("Paramètres invalides.");
|
||||
$db->mergeLanguage($sourceId, $targetId);
|
||||
break;
|
||||
|
||||
case 'merge_bulk':
|
||||
$targetId = filter_var($_POST['target_id'] ?? '', FILTER_VALIDATE_INT);
|
||||
$sourceIds = isset($_POST['selected_langs']) && is_array($_POST['selected_langs'])
|
||||
? array_map('intval', $_POST['selected_langs'])
|
||||
: [];
|
||||
if (!$targetId || empty($sourceIds)) throw new Exception("Paramètres invalides.");
|
||||
$sourceIds = array_values(array_diff($sourceIds, [$targetId]));
|
||||
if (empty($sourceIds)) throw new Exception("Aucune source à fusionner.");
|
||||
foreach ($sourceIds as $sid) {
|
||||
$db->mergeLanguage($sid, $targetId);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$id = filter_var($_POST['language_id'] ?? '', FILTER_VALIDATE_INT);
|
||||
if (!$id) throw new Exception("ID invalide.");
|
||||
$db->deleteLanguage($id);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new Exception("Action inconnue.");
|
||||
}
|
||||
|
||||
App::flash('success', "Opération effectuée.");
|
||||
} catch (Exception $e) {
|
||||
ErrorHandler::log('language', $e);
|
||||
App::flash('error', ErrorHandler::userMessage($e));
|
||||
}
|
||||
|
||||
$redirect = '/admin/contenus.php';
|
||||
// Allow the caller to override the redirect
|
||||
if (!empty($_POST['return']) && str_starts_with($_POST['return'], '/')) {
|
||||
$redirect = $_POST['return'];
|
||||
}
|
||||
header('Location: ' . $redirect);
|
||||
exit();
|
||||
@@ -36,6 +36,20 @@ try {
|
||||
$logger->logTagAction('merge', ['source_id' => $sourceId, 'target_id' => $targetId]);
|
||||
break;
|
||||
|
||||
case 'merge_bulk':
|
||||
$targetId = filter_var($_POST['target_id'] ?? '', FILTER_VALIDATE_INT);
|
||||
$sourceIds = isset($_POST['selected_tags']) && is_array($_POST['selected_tags'])
|
||||
? array_map('intval', $_POST['selected_tags'])
|
||||
: [];
|
||||
if (!$targetId || empty($sourceIds)) throw new Exception("Paramètres invalides.");
|
||||
$sourceIds = array_values(array_diff($sourceIds, [$targetId]));
|
||||
if (empty($sourceIds)) throw new Exception("Aucune source à fusionner.");
|
||||
foreach ($sourceIds as $sid) {
|
||||
$db->mergeTag($sid, $targetId);
|
||||
$logger->logTagAction('merge', ['source_id' => $sid, 'target_id' => $targetId]);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
$id = filter_var($_POST['tag_id'] ?? '', FILTER_VALIDATE_INT);
|
||||
if (!$id) throw new Exception("ID invalide.");
|
||||
@@ -53,5 +67,10 @@ try {
|
||||
App::flash('error', ErrorHandler::userMessage($e));
|
||||
}
|
||||
|
||||
header('Location: /admin/tags.php');
|
||||
$redirect = '/admin/tags.php';
|
||||
// Allow the caller to override the redirect
|
||||
if (!empty($_POST['return']) && str_starts_with($_POST['return'], '/')) {
|
||||
$redirect = $_POST['return'];
|
||||
}
|
||||
header('Location: ' . $redirect);
|
||||
exit();
|
||||
|
||||
114
app/public/admin/contenus-langues-fragment.php
Normal file
114
app/public/admin/contenus-langues-fragment.php
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
/**
|
||||
* contenus-langues-fragment.php
|
||||
*
|
||||
* HTMX fragment: returns the langues table for the contenus page,
|
||||
* optionally filtered by a search query.
|
||||
*/
|
||||
require_once __DIR__ . '/../../bootstrap.php';
|
||||
require_once __DIR__ . '/../../src/AdminAuth.php';
|
||||
AdminAuth::requireLogin();
|
||||
|
||||
if (empty($_SESSION['csrf_token'])) {
|
||||
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/../../src/Database.php';
|
||||
|
||||
$searchQuery = trim($_GET['q'] ?? '');
|
||||
|
||||
try {
|
||||
$db = new Database();
|
||||
$languages = ($searchQuery !== '') ? $db->searchLanguages($searchQuery) : $db->getAllLanguagesWithCount();
|
||||
} catch (Exception $e) {
|
||||
die('<div class="flash-error">Erreur : ' . htmlspecialchars($e->getMessage()) . '</div>');
|
||||
}
|
||||
?>
|
||||
<div id="langues-bulk-actions" class="admin-bulk-actions" style="display:none">
|
||||
<strong><span id="langues-selected-count">0</span> langue(s) sélectionnée(s)</strong>
|
||||
<div class="admin-bulk-btns">
|
||||
<button type="button" class="btn btn--sm btn--warning admin-btn-merge"
|
||||
onclick="languesConfirmBulkMerge()"
|
||||
title="Fusionner les langues sélectionnées">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256"><path d="M224,152V96a8,8,0,0,0-8-8H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8v64h0v56a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V152Zm-68.69,56L48,100.69V59.31L196.69,208Zm-96-160h41.38L208,155.31v41.38ZM208,132.69,179.31,104H208Zm-56-56L123.31,48H152ZM48,123.31,76.69,152H48Zm56,56L132.69,208H104Z"></path></svg>
|
||||
Fusionner
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="langues-bulk-form" method="post" action="actions/language.php">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<input type="hidden" name="action" value="merge_bulk">
|
||||
<input type="hidden" name="return" value="/admin/contenus.php">
|
||||
<input type="hidden" name="target_id" id="langues-bulk-target" value="">
|
||||
<div id="langues-bulk-checkboxes"></div>
|
||||
</form>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><input type="checkbox" onchange="languesToggleAll(this)"></th>
|
||||
<th scope="col">Nom</th>
|
||||
<th scope="col">TFE Associé</th>
|
||||
<th scope="col">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($languages)): ?>
|
||||
<tr><td colspan="4" class="admin-empty">Aucune langue trouvée.</td></tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($languages as $lang): ?>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="selected_langs[]" value="<?= (int)$lang['id'] ?>" onchange="languesUpdateBulk()"></td>
|
||||
<td><?= htmlspecialchars($lang['name']) ?></td>
|
||||
<td class="admin-tags-count"><?= (int)$lang['thesis_count'] ?></td>
|
||||
<td class="admin-actions-col">
|
||||
<div class="admin-actions">
|
||||
<form method="post" action="actions/language.php" class="admin-inline-form">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<input type="hidden" name="action" value="rename">
|
||||
<input type="hidden" name="return" value="/admin/contenus.php">
|
||||
<input type="hidden" name="language_id" value="<?= (int)$lang['id'] ?>">
|
||||
<input class="admin-input--inline" type="text" name="new_name"
|
||||
value="<?= htmlspecialchars($lang['name']) ?>" required>
|
||||
<button type="submit" class="admin-icon-btn admin-icon-btn--edit" title="Renommer">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256"><path d="M248,92.68a15.86,15.86,0,0,0-4.69-11.31L174.63,12.68a16,16,0,0,0-22.63,0L123.57,41.11l-58,21.77A16.06,16.06,0,0,0,55.35,75.23L32.11,214.68A8,8,0,0,0,40,224a8.4,8.4,0,0,0,1.32-.11l139.44-23.24a16,16,0,0,0,12.35-10.17l21.77-58L243.31,104A15.87,15.87,0,0,0,248,92.68Zm-69.87,92.19L63.32,204l47.37-47.37a28,28,0,1,0-11.32-11.32L52,192.7,71.13,77.86,126,57.29,198.7,130ZM112,132a12,12,0,1,1,12,12A12,12,0,0,1,112,132Zm96-15.32L139.31,48l24-24L232,92.68Z"></path></svg>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form method="post" action="actions/language.php" class="admin-inline-form">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<input type="hidden" name="action" value="merge">
|
||||
<input type="hidden" name="return" value="/admin/contenus.php">
|
||||
<input type="hidden" name="source_id" value="<?= (int)$lang['id'] ?>">
|
||||
<select name="target_id" class="admin-select--inline" required>
|
||||
<option value="">— Fusionner dans… —</option>
|
||||
<?php foreach ($languages as $other): ?>
|
||||
<?php if ($other['id'] !== $lang['id']): ?>
|
||||
<option value="<?= (int)$other['id'] ?>"><?= htmlspecialchars($other['name']) ?></option>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<button type="button" class="admin-icon-btn admin-icon-btn--merge" title="Fusionner"
|
||||
onclick="return languesConfirmMerge(this)">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256"><path d="M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"></path></svg>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form method="post" action="actions/language.php" class="admin-inline-form">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<input type="hidden" name="return" value="/admin/contenus.php">
|
||||
<input type="hidden" name="language_id" value="<?= (int)$lang['id'] ?>">
|
||||
<button type="button" class="admin-icon-btn admin-icon-btn--delete" title="Supprimer"
|
||||
onclick="languesConfirmDelete(this, <?= htmlspecialchars(json_encode($lang['name']), ENT_QUOTES) ?>)">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256"><path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"></path></svg>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
109
app/public/admin/tags-fragment.php
Normal file
109
app/public/admin/tags-fragment.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
/**
|
||||
* tags-fragment.php
|
||||
*
|
||||
* HTMX fragment: returns the tags table, optionally filtered by search query.
|
||||
*/
|
||||
require_once __DIR__ . '/../../bootstrap.php';
|
||||
require_once __DIR__ . '/../../src/AdminAuth.php';
|
||||
AdminAuth::requireLogin();
|
||||
|
||||
if (empty($_SESSION['csrf_token'])) {
|
||||
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/../../src/Database.php';
|
||||
|
||||
$searchQuery = trim($_GET['q'] ?? '');
|
||||
|
||||
try {
|
||||
$db = new Database();
|
||||
$tags = ($searchQuery !== '') ? $db->searchTags($searchQuery) : $db->getAllTagsWithCount();
|
||||
} catch (Exception $e) {
|
||||
die('<div class="flash-error">Erreur : ' . htmlspecialchars($e->getMessage()) . '</div>');
|
||||
}
|
||||
?>
|
||||
<div id="tags-bulk-actions" class="admin-bulk-actions" style="display:none">
|
||||
<strong><span id="tags-selected-count">0</span> mot(s)-clé(s) sélectionné(s)</strong>
|
||||
<div class="admin-bulk-btns">
|
||||
<button type="button" class="btn btn--sm btn--warning admin-btn-merge"
|
||||
onclick="tagsConfirmBulkMerge()"
|
||||
title="Fusionner les mots-clés sélectionnés">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256"><path d="M224,152V96a8,8,0,0,0-8-8H168V40a8,8,0,0,0-8-8H40a8,8,0,0,0-8,8v64h0v56a8,8,0,0,0,8,8H88v48a8,8,0,0,0,8,8H216a8,8,0,0,0,8-8V152Zm-68.69,56L48,100.69V59.31L196.69,208Zm-96-160h41.38L208,155.31v41.38ZM208,132.69,179.31,104H208Zm-56-56L123.31,48H152ZM48,123.31,76.69,152H48Zm56,56L132.69,208H104Z"></path></svg>
|
||||
Fusionner
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<form id="tags-bulk-form" method="post" action="actions/tag.php">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<input type="hidden" name="action" value="merge_bulk">
|
||||
<input type="hidden" name="target_id" id="tags-bulk-target" value="">
|
||||
<div id="tags-bulk-checkboxes"></div>
|
||||
</form>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><input type="checkbox" onchange="tagsToggleAll(this)"></th>
|
||||
<th scope="col">Nom</th>
|
||||
<th scope="col">TFE associés</th>
|
||||
<th scope="col">Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (empty($tags)): ?>
|
||||
<tr><td colspan="4" class="admin-empty">Aucun mot-clé trouvé.</td></tr>
|
||||
<?php else: ?>
|
||||
<?php foreach ($tags as $tag): ?>
|
||||
<tr>
|
||||
<td><input type="checkbox" name="selected_tags[]" value="<?= (int)$tag['id'] ?>" onchange="tagsUpdateBulk()"></td>
|
||||
<td><?= htmlspecialchars($tag['name']) ?></td>
|
||||
<td class="admin-tags-count"><?= (int)$tag['thesis_count'] ?></td>
|
||||
<td class="admin-actions-col">
|
||||
<div class="admin-actions">
|
||||
<form method="post" action="actions/tag.php" class="admin-inline-form">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<input type="hidden" name="action" value="rename">
|
||||
<input type="hidden" name="tag_id" value="<?= (int)$tag['id'] ?>">
|
||||
<input class="admin-input--inline" type="text" name="new_name"
|
||||
value="<?= htmlspecialchars($tag['name']) ?>" required>
|
||||
<button type="submit" class="admin-icon-btn admin-icon-btn--edit" title="Renommer">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256"><path d="M248,92.68a15.86,15.86,0,0,0-4.69-11.31L174.63,12.68a16,16,0,0,0-22.63,0L123.57,41.11l-58,21.77A16.06,16.06,0,0,0,55.35,75.23L32.11,214.68A8,8,0,0,0,40,224a8.4,8.4,0,0,0,1.32-.11l139.44-23.24a16,16,0,0,0,12.35-10.17l21.77-58L243.31,104A15.87,15.87,0,0,0,248,92.68Zm-69.87,92.19L63.32,204l47.37-47.37a28,28,0,1,0-11.32-11.32L52,192.7,71.13,77.86,126,57.29,198.7,130ZM112,132a12,12,0,1,1,12,12A12,12,0,0,1,112,132Zm96-15.32L139.31,48l24-24L232,92.68Z"></path></svg>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form method="post" action="actions/tag.php" class="admin-inline-form">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<input type="hidden" name="action" value="merge">
|
||||
<input type="hidden" name="source_id" value="<?= (int)$tag['id'] ?>">
|
||||
<select name="target_id" class="admin-select--inline" required>
|
||||
<option value="">— Fusionner dans… —</option>
|
||||
<?php foreach ($tags as $other): ?>
|
||||
<?php if ($other['id'] !== $tag['id']): ?>
|
||||
<option value="<?= (int)$other['id'] ?>"><?= htmlspecialchars($other['name']) ?></option>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
<button type="button" class="admin-icon-btn admin-icon-btn--merge" title="Fusionner"
|
||||
onclick="return tagsConfirmMerge(this)">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256"><path d="M216,32H88a8,8,0,0,0-8,8V80H40a8,8,0,0,0-8,8V216a8,8,0,0,0,8,8H168a8,8,0,0,0,8-8V176h40a8,8,0,0,0,8-8V40A8,8,0,0,0,216,32ZM160,208H48V96H160Zm48-48H176V88a8,8,0,0,0-8-8H96V48H208Z"></path></svg>
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<form method="post" action="actions/tag.php" class="admin-inline-form">
|
||||
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($_SESSION['csrf_token']) ?>">
|
||||
<input type="hidden" name="action" value="delete">
|
||||
<input type="hidden" name="tag_id" value="<?= (int)$tag['id'] ?>">
|
||||
<button type="button" class="admin-icon-btn admin-icon-btn--delete" title="Supprimer"
|
||||
onclick="tagsConfirmDelete(this, <?= htmlspecialchars(json_encode($tag['name']), ENT_QUOTES) ?>)">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256"><path d="M216,48H176V40a24,24,0,0,0-24-24H104A24,24,0,0,0,80,40v8H40a8,8,0,0,0,0,16h8V208a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64h8a8,8,0,0,0,0-16ZM96,40a8,8,0,0,1,8-8h48a8,8,0,0,1,8,8v8H96Zm96,168H64V64H192ZM112,104v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Zm48,0v64a8,8,0,0,1-16,0V104a8,8,0,0,1,16,0Z"></path></svg>
|
||||
</button>
|
||||
</form>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -7,17 +7,8 @@ if (empty($_SESSION['csrf_token'])) {
|
||||
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
||||
}
|
||||
|
||||
require_once __DIR__ . '/../../src/Database.php';
|
||||
|
||||
$pageTitle = "Gestion des mots-clés";
|
||||
|
||||
try {
|
||||
$db = new Database();
|
||||
$tags = $db->getAllTagsWithCount();
|
||||
} catch (Exception $e) {
|
||||
die("Erreur : " . htmlspecialchars($e->getMessage()));
|
||||
}
|
||||
|
||||
$isAdmin = true; $bodyClass = 'admin-body';
|
||||
require_once APP_ROOT . '/templates/head.php';
|
||||
include APP_ROOT . '/templates/header.php';
|
||||
|
||||
@@ -615,16 +615,14 @@ th.admin-ap-col {
|
||||
margin-bottom: var(--space-xl);
|
||||
}
|
||||
|
||||
/* Fieldsets inside flat sections: no card border */
|
||||
.admin-body main > section[aria-labelledby^="settings-"] fieldset,
|
||||
.admin-body main > section[aria-labelledby^="form-settings-"] fieldset {
|
||||
/* Fieldsets inside flat settings sections: no card border */
|
||||
.admin-body main > section[aria-labelledby^="settings-"] fieldset {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
padding: var(--space-m) 0;
|
||||
}
|
||||
|
||||
.admin-body main > section[aria-labelledby^="settings-"] fieldset legend,
|
||||
.admin-body main > section[aria-labelledby^="form-settings-"] fieldset legend {
|
||||
.admin-body main > section[aria-labelledby^="settings-"] fieldset legend {
|
||||
padding: 0;
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.04em;
|
||||
@@ -633,8 +631,7 @@ th.admin-ap-col {
|
||||
}
|
||||
|
||||
.admin-body main > section[aria-labelledby^="settings-"] > h2,
|
||||
.admin-body main > section[aria-labelledby^="static-pages-"] > h2,
|
||||
.admin-body main > section[aria-labelledby^="form-settings-"] > h2 {
|
||||
.admin-body main > section[aria-labelledby^="static-pages-"] > h2 {
|
||||
font-weight: 600;
|
||||
letter-spacing: 0.06em;
|
||||
text-transform: uppercase;
|
||||
@@ -1992,3 +1989,56 @@ th.admin-ap-col {
|
||||
50.01% { transform: scaleX(1); transform-origin: right; }
|
||||
100% { transform: scaleX(0); transform-origin: right; }
|
||||
}
|
||||
|
||||
/* ── Sidebar TOC ───────────────────────────────────────────────────────────── */
|
||||
|
||||
.admin-with-toc {
|
||||
display: flex;
|
||||
gap: var(--space-m);
|
||||
align-items: flex-start;
|
||||
max-width: var(--content-max-width, 1200px);
|
||||
margin: 0 auto;
|
||||
padding: 0 var(--space-s);
|
||||
}
|
||||
|
||||
.admin-with-toc > main {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.admin-toc {
|
||||
position: sticky;
|
||||
top: var(--space-m);
|
||||
width: 160px;
|
||||
flex-shrink: 0;
|
||||
padding-top: var(--space-s);
|
||||
}
|
||||
|
||||
.admin-toc-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.admin-toc-list a {
|
||||
display: block;
|
||||
padding: var(--space-3xs) var(--space-2xs);
|
||||
font-size: var(--step--2);
|
||||
color: var(--text-secondary);
|
||||
text-decoration: none;
|
||||
border-left: 2px solid transparent;
|
||||
transition: color 0.15s, border-color 0.15s;
|
||||
}
|
||||
|
||||
.admin-toc-list a:hover {
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.admin-toc-list a.admin-toc-active {
|
||||
color: var(--text-primary);
|
||||
font-weight: 600;
|
||||
border-left-color: var(--accent, var(--color-primary));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user