Refactor apropos/charte/licence pages: shared layout, TOC anchors, and UI polish

Unify the three public pages (à propos, charte, licence) onto a single
grid layout (.page-content) with sticky TOC sidebar, replacing the old
separate  /  /  markup.

- Merge about.php, charte.php, licence.php templates into shared
  .page-content / .content-section structure
- Add CommonMark HeadingPermalinkExtension for stable heading anchors
- Use SlugNormalizer for TOC links so they match rendered heading IDs
- Standardize link styling across content blocks: bold black, accent on
  hover (consistent with global link style)
- Fix code block wrapping: use pre-wrap instead of pre, constrain grid
  columns with min-width:0, auto scrollbar
- Fix apropos page grid placement: force content-section into column 2
  so contacts and credits stay in the content area, not the sidebar

Also includes accumulated WIP changes:
- Header gradient: hardcoded purple-to-green (replaces CSS variables)
- Search placeholder font
- Duration field: replace minutes/sec/heures with h:m:s time inputs
- TFE file optional for formats 1,4,6 with client-side JS toggle
- Licence form: em-dash to hyphen, details/summary classes
- Pill search: block Enter key form submission when no results
- Draft autosave: remove CSRF rotation (broke concurrent FilePond uploads)
- Language pill: clear hints for excluded main languages
- Search results: gradient placeholder cards for items without covers
- TFE display: format durée values as XhYm instead of decimal
This commit is contained in:
Pontoporeia
2026-06-15 16:35:17 +02:00
parent 928e074d24
commit 19bf9f101a
27 changed files with 636 additions and 342 deletions

View File

@@ -643,6 +643,7 @@
enableFilepondMode();
_xamxamFilepondReady = false;
window.XamxamInitFilePonds();
if (window.XamxamUpdateTfeRequired) window.XamxamUpdateTfeRequired();
setTimeout(() => {
_xamxamFilepondReady = true;
}, 0);
@@ -694,6 +695,68 @@
}
});
// ── TFE file optional when Site web (1), Performance (4) or Installation (6) ──
// The format checkboxes no longer trigger HTMX swaps; this JS toggles the TFE
// required attribute and asterisk client-side so the student sees immediate feedback.
// admin_mode hidden input (value="1") suppresses required toggling for admins.
(function () {
var optionalFormatIds = ["1", "4", "6"];
function isAdminMode() {
var el = document.querySelector('input[name="admin_mode"]');
return el && el.value === "1";
}
function updateTfeRequired() {
if (isAdminMode()) return;
var tfeInput = document.getElementById("tfe-files-input");
if (!tfeInput) return;
var checkedAny = false;
var boxes = document.querySelectorAll('input[name="formats[]"]:checked');
for (var i = 0; i < boxes.length; i++) {
if (optionalFormatIds.indexOf(boxes[i].value) !== -1) {
checkedAny = true;
break;
}
}
// Find the label for the TFE input (its parent group's <label>)
var fieldGroup = tfeInput.closest(".admin-files-fieldgroup");
var label = fieldGroup ? fieldGroup.querySelector("label[for='tfe-files-input']") : null;
if (checkedAny) {
tfeInput.removeAttribute("required");
// Replace asterisk + optional text
if (label) {
label.textContent = "TFE (optionnel pour ce format)";
}
} else {
tfeInput.setAttribute("required", "");
if (label) {
label.innerHTML = "TFE <span class='asterisk'>*</span>";
}
}
}
// Delegate change events on the format fieldset
var formatFieldset = document.getElementById("fieldset-formats");
if (formatFieldset) {
formatFieldset.addEventListener("change", function (e) {
if (e.target && e.target.name === "formats[]") {
updateTfeRequired();
}
});
}
// Run once on page load
updateTfeRequired();
// Expose for HTMX afterSwap re-init
window.XamxamUpdateTfeRequired = updateTfeRequired;
})();
// ── Relink file browser ──────────────────────────────────────────
/**

View File

@@ -159,8 +159,14 @@
}
highlight(selectedIdx);
} else if (e.key === "Enter") {
// Always prevent Enter from submitting the form.
// If there are no suggestions (e.g., "anglais" in language
// search — excluded main language), the Enter key would
// otherwise propagate to the form and trigger its hx-post to
// draft.php, causing the JSON response to replace the form
// content.
e.preventDefault();
if (items.length > 0) {
e.preventDefault();
if (selectedIdx >= 0 && selectedIdx < items.length) {
selectPill(items[selectedIdx]);
} else {