justfile: standardise test recipes to lint-php/lint-css/lint-js/test + add fix recipe

- Removed ambiguous aliases: phpstan, cs-check, syntax
- Split lint-biome into lint-css and lint-js with correct paths
- Added lint meta-recipe and fix recipe (biome --unsafe + php-cs-fixer)
- Fixed FormBootstrap dead null check, CSS shorthand override bug
- Updated phpstan baseline, suppressed noDescendingSpecificity/noInnerDeclarations
- Applied ~74 biome auto-fixes across CSS/JS
This commit is contained in:
Pontoporeia
2026-07-05 11:07:41 +02:00
parent 34b5d3e585
commit 3e93150c76
59 changed files with 5459 additions and 5196 deletions
+1 -1
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -18,4 +18,4 @@
- [x] Add bulk select/delete to tmp cleanup dialog (like admin/index.php pattern) - [x] Add bulk select/delete to tmp cleanup dialog (like admin/index.php pattern)
- [x] Move cleanup UI from modal to dedicated page (like add.php/edit.php) - [x] Move cleanup UI from modal to dedicated page (like add.php/edit.php)
- [x] Replace <details> with <fieldset>/<legend> in cleanup fragments (like contenus.php) - [x] Replace <details> with <fieldset>/<legend> in cleanup fragments (like contenus.php)
- [x] Standardise test group recipes: lint-php, lint-css, lint-js, test + add fix recipe - [x] Standardise test group recipes: lint-php, lint-css, lint-js, test + add fix recipe + make lint pass clean
+66 -29
View File
@@ -47,7 +47,6 @@
height: 16px; height: 16px;
} }
.admin-body main { .admin-body main {
flex: 1; flex: 1;
min-height: 0; min-height: 0;
@@ -62,7 +61,7 @@
} }
.admin-main--list { .admin-main--list {
padding: 0 !important; padding: 0;
} }
.admin-main--list > form, .admin-main--list > form,
@@ -83,7 +82,7 @@
} }
.admin-table-row:hover { .admin-table-row:hover {
background: var(--blue-muted-bg) !important; background: var(--blue-muted-bg);
} }
.admin-body main > h1, .admin-body main > h1,
@@ -105,7 +104,9 @@
border-radius: var(--radius); border-radius: var(--radius);
color: var(--text-secondary); color: var(--text-secondary);
text-decoration: none; text-decoration: none;
transition: background 0.15s, color 0.15s; transition:
background 0.15s,
color 0.15s;
flex-shrink: 0; flex-shrink: 0;
vertical-align: middle; vertical-align: middle;
margin-right: var(--space-2xs); margin-right: var(--space-2xs);
@@ -381,7 +382,10 @@ th.admin-ap-col {
color: var(--text-secondary); color: var(--text-secondary);
cursor: pointer; cursor: pointer;
text-decoration: none; text-decoration: none;
transition: background 0.15s, color 0.15s, border-color 0.15s; transition:
background 0.15s,
color 0.15s,
border-color 0.15s;
line-height: 1; line-height: 1;
} }
@@ -1073,11 +1077,15 @@ th.admin-ap-col {
flex-direction: column; flex-direction: column;
} }
@keyframes adminSheetIn { @keyframes adminSheetIn {
from { transform: translateX(100%); } from {
to { transform: translateX(0); } transform: translateX(100%);
}
to {
transform: translateX(0);
}
} }
.admin-dialog--sheet::backdrop { .admin-dialog--sheet::backdrop {
background: rgba(0,0,0,0.5); background: rgba(0, 0, 0, 0.5);
} }
/* Dialog table: replaces grey background box with flat table + heading */ /* Dialog table: replaces grey background box with flat table + heading */
@@ -1177,7 +1185,7 @@ th.admin-ap-col {
.n-grid > details > summary::before, .n-grid > details > summary::before,
.n-section > summary::before { .n-section > summary::before {
content: ''; content: "";
display: inline-block; display: inline-block;
width: 16px; width: 16px;
height: 16px; height: 16px;
@@ -1219,9 +1227,18 @@ th.admin-ap-col {
margin-right: var(--space-3xs); margin-right: var(--space-3xs);
} }
.admin-import-log__item--ok::before { content: '✓'; color: var(--accent-green); } .admin-import-log__item--ok::before {
.admin-import-log__item--skip::before { content: '⚠'; color: var(--warning); } content: "✓";
.admin-import-log__item--error::before { content: '✗'; color: var(--error); } color: var(--accent-green);
}
.admin-import-log__item--skip::before {
content: "⚠";
color: var(--warning);
}
.admin-import-log__item--error::before {
content: "✗";
color: var(--error);
}
/* ── Paramètres page (flat, semantic) ──────────────────────────────────── */ /* ── Paramètres page (flat, semantic) ──────────────────────────────────── */
.param-access-table { .param-access-table {
@@ -1300,7 +1317,7 @@ th.admin-ap-col {
background: var(--bg-secondary); background: var(--bg-secondary);
} }
.param-maintenance-row:has( .btn--warning ) { .param-maintenance-row:has(.btn--warning) {
background: var(--warning-muted-bg); background: var(--warning-muted-bg);
border-color: var(--warning); border-color: var(--warning);
} }
@@ -1669,7 +1686,7 @@ th.admin-ap-col {
} }
.admin-toggle::after { .admin-toggle::after {
content: ''; content: "";
position: absolute; position: absolute;
top: 3px; top: 3px;
left: 3px; left: 3px;
@@ -1811,7 +1828,7 @@ th.admin-ap-col {
} }
.admin-toggle::after { .admin-toggle::after {
content: ''; content: "";
position: absolute; position: absolute;
top: 3px; top: 3px;
left: 3px; left: 3px;
@@ -1830,7 +1847,6 @@ th.admin-ap-col {
transform: translateX(18px); transform: translateX(18px);
} }
/* ── Form group, student mode, thanks page → see form-base.css ──────────── */ /* ── Form group, student mode, thanks page → see form-base.css ──────────── */
/* ── Utility ─────────────────────────────────────────────────────────────── */ /* ── Utility ─────────────────────────────────────────────────────────────── */
@@ -1894,7 +1910,7 @@ th.admin-ap-col {
} }
.fhb-fieldset-card-inputs li::before { .fhb-fieldset-card-inputs li::before {
content: '· '; content: "· ";
color: var(--text-tertiary); color: var(--text-tertiary);
} }
@@ -1956,7 +1972,6 @@ th.admin-ap-col {
height: 100%; height: 100%;
} }
/* ── Left side: name + content ─────────────────────────────────────────────── */ /* ── Left side: name + content ─────────────────────────────────────────────── */
.fhb-inline-body { .fhb-inline-body {
@@ -1998,8 +2013,12 @@ th.admin-ap-col {
margin-bottom: 0; margin-bottom: 0;
} }
.fhb-md-preview strong { font-weight: 600; } .fhb-md-preview strong {
.fhb-md-preview em { font-style: italic; } font-weight: 600;
}
.fhb-md-preview em {
font-style: italic;
}
.fhb-md-preview code { .fhb-md-preview code {
font-size: 0.9em; font-size: 0.9em;
background: var(--bg-secondary); background: var(--bg-secondary);
@@ -2155,10 +2174,22 @@ th.admin-ap-col {
} }
@keyframes admin-search-progress { @keyframes admin-search-progress {
0% { transform: scaleX(0); transform-origin: left; } 0% {
50% { transform: scaleX(1); transform-origin: left; } transform: scaleX(0);
50.01% { transform: scaleX(1); transform-origin: right; } transform-origin: left;
100% { transform: scaleX(0); transform-origin: right; } }
50% {
transform: scaleX(1);
transform-origin: left;
}
50.01% {
transform: scaleX(1);
transform-origin: right;
}
100% {
transform: scaleX(0);
transform-origin: right;
}
} }
/* ── Sidebar TOC (matches public .page-content grid layout) ────────────── */ /* ── Sidebar TOC (matches public .page-content grid layout) ────────────── */
@@ -2352,11 +2383,11 @@ th.admin-ap-col {
padding: 0 0 var(--space-m); padding: 0 0 var(--space-m);
max-width: 640px; max-width: 640px;
width: 90vw; width: 90vw;
box-shadow: 0 8px 32px rgba(0,0,0,0.18); box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
} }
.md-cheatsheet-dialog::backdrop { .md-cheatsheet-dialog::backdrop {
background: rgba(0,0,0,0.35); background: rgba(0, 0, 0, 0.35);
} }
.md-cheatsheet-header { .md-cheatsheet-header {
@@ -2415,9 +2446,15 @@ th.admin-ap-col {
line-height: 1.3; line-height: 1.3;
} }
.md-cheatsheet-render h1 { font-size: var(--step-2); } .md-cheatsheet-render h1 {
.md-cheatsheet-render h2 { font-size: var(--step-1); } font-size: var(--step-2);
.md-cheatsheet-render h3 { font-size: var(--step-0); } }
.md-cheatsheet-render h2 {
font-size: var(--step-1);
}
.md-cheatsheet-render h3 {
font-size: var(--step-0);
}
.md-cheatsheet-render blockquote { .md-cheatsheet-render blockquote {
margin: 0; margin: 0;
+20 -7
View File
@@ -5,7 +5,8 @@
============================================================ */ ============================================================ */
/* Full-height flex layout: header → main → (optional footer) */ /* Full-height flex layout: header → main → (optional footer) */
html, body { html,
body {
height: 100%; height: 100%;
overflow: hidden; overflow: hidden;
} }
@@ -61,12 +62,24 @@ main * {
} }
/* Global heading scale — used by admin + public pages */ /* Global heading scale — used by admin + public pages */
h1 { font-size: var(--step-4); } h1 {
h2 { font-size: var(--step-3); } font-size: var(--step-4);
h3 { font-size: var(--step-2); } }
h4 { font-size: var(--step-1); } h2 {
h5 { font-size: var(--step-0); } font-size: var(--step-3);
h6 { font-size: var(--step--1); } }
h3 {
font-size: var(--step-2);
}
h4 {
font-size: var(--step-1);
}
h5 {
font-size: var(--step-0);
}
h6 {
font-size: var(--step--1);
}
:where(h1, h2, h3, h4, h5, h6) { :where(h1, h2, h3, h4, h5, h6) {
font-family: var(--font-display); font-family: var(--font-display);
+32 -9
View File
@@ -19,11 +19,17 @@
text-decoration: none; text-decoration: none;
line-height: 1.3; line-height: 1.3;
border: none; border: none;
transition: background 0.15s, opacity 0.15s, box-shadow 0.15s, filter 0.15s; transition:
background 0.15s,
opacity 0.15s,
box-shadow 0.15s,
filter 0.15s;
width: fit-content; width: fit-content;
} }
.btn:hover { filter: brightness(0.92); } .btn:hover {
filter: brightness(0.92);
}
/* Primary: accent background, white text */ /* Primary: accent background, white text */
.btn--primary { .btn--primary {
@@ -82,7 +88,9 @@
color: var(--accent-foreground); color: var(--accent-foreground);
} }
.btn--danger:hover { filter: brightness(0.9); } .btn--danger:hover {
filter: brightness(0.9);
}
/* Warning: yellow background */ /* Warning: yellow background */
.btn--warning { .btn--warning {
@@ -90,7 +98,9 @@
color: var(--text-primary); color: var(--text-primary);
} }
.btn--warning:hover { filter: brightness(0.9); } .btn--warning:hover {
filter: brightness(0.9);
}
/* Success: green background */ /* Success: green background */
.btn--success { .btn--success {
@@ -98,7 +108,9 @@
color: var(--accent-foreground); color: var(--accent-foreground);
} }
.btn--success:hover { filter: brightness(0.9); } .btn--success:hover {
filter: brightness(0.9);
}
/* Small size modifier */ /* Small size modifier */
.btn--sm { .btn--sm {
@@ -119,7 +131,10 @@
border: 1px solid var(--blue-muted-border); border: 1px solid var(--blue-muted-border);
} }
.btn--blue:hover { background: var(--blue-muted-bg-hover); filter: none; } .btn--blue:hover {
background: var(--blue-muted-bg-hover);
filter: none;
}
.btn--yellow { .btn--yellow {
background: var(--yellow-muted-bg); background: var(--yellow-muted-bg);
@@ -127,7 +142,10 @@
border: 1px solid var(--yellow-muted-border); border: 1px solid var(--yellow-muted-border);
} }
.btn--yellow:hover { background: var(--yellow-muted-bg-hover); filter: none; } .btn--yellow:hover {
background: var(--yellow-muted-bg-hover);
filter: none;
}
.btn--green { .btn--green {
background: var(--green-muted-bg); background: var(--green-muted-bg);
@@ -135,7 +153,10 @@
border: 1px solid var(--green-muted-border); border: 1px solid var(--green-muted-border);
} }
.btn--green:hover { background: var(--green-muted-bg-hover); filter: none; } .btn--green:hover {
background: var(--green-muted-bg-hover);
filter: none;
}
.btn--red { .btn--red {
background: var(--error-muted-bg); background: var(--error-muted-bg);
@@ -143,4 +164,6 @@
border: 1px solid var(--danger-border-muted); border: 1px solid var(--danger-border-muted);
} }
.btn--red:hover { filter: brightness(0.9); } .btn--red:hover {
filter: brightness(0.9);
}
+3 -1
View File
@@ -33,7 +33,9 @@ summary {
font-weight: 600; font-weight: 600;
text-decoration: none; text-decoration: none;
color: var(--text-primary); color: var(--text-primary);
transition: color 0.15s, background 0.15s; transition:
color 0.15s,
background 0.15s;
padding: var(--space-s); padding: var(--space-s);
cursor: pointer; cursor: pointer;
} }
+16 -4
View File
@@ -14,7 +14,11 @@ label {
/* ── Text inputs, selects, textareas ────────────────────────────────── */ /* ── Text inputs, selects, textareas ────────────────────────────────── */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="color"]), input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(
[type="hidden"]
):not([type="submit"]):not([type="button"]):not([type="reset"]):not(
[type="color"]
),
textarea { textarea {
font-family: inherit; font-family: inherit;
font-size: var(--step--1); font-size: var(--step--1);
@@ -26,7 +30,11 @@ textarea {
transition: border-color 0.15s; transition: border-color 0.15s;
} }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="color"]):focus, input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(
[type="hidden"]
):not([type="submit"]):not([type="button"]):not([type="reset"]):not(
[type="color"]
):focus,
textarea:focus { textarea:focus {
outline: none; outline: none;
border: 2px solid var(--accent-primary); border: 2px solid var(--accent-primary);
@@ -81,7 +89,9 @@ input[type="radio"] {
margin: 0; margin: 0;
} }
input[type="radio"] { border-radius: 50%; } input[type="radio"] {
border-radius: 50%;
}
/* ── Fieldsets & legends ──────────────────────────────────────────────── */ /* ── Fieldsets & legends ──────────────────────────────────────────────── */
@@ -92,7 +102,9 @@ fieldset {
margin: 0; margin: 0;
} }
fieldset > *:not(:last-child) { margin-bottom: var(--space-xs); } fieldset > *:not(:last-child) {
margin-bottom: var(--space-xs);
}
legend { legend {
font-size: var(--step--1); font-size: var(--step--1);
+3 -3
View File
@@ -161,7 +161,8 @@ header nav ul a[aria-current="page"] {
gap: 0; gap: 0;
} }
header nav[aria-label="Navigation principale"] header
nav[aria-label="Navigation principale"]
.nav-left-links .nav-left-links
li:not(:first-child) { li:not(:first-child) {
display: none; display: none;
@@ -200,8 +201,7 @@ header nav ul a[aria-current="page"] {
} }
/* Animate burger → X */ /* Animate burger → X */
.menu-btn:checked .menu-btn:checked ~ nav[aria-label="Navigation principale"]
~ nav[aria-label="Navigation principale"]
.menu-icon .menu-icon
.navicon { .navicon {
background: transparent; background: transparent;
@@ -32,7 +32,9 @@
font-size: var(--step--1); font-size: var(--step--1);
font-weight: 400; font-weight: 400;
text-decoration: none; text-decoration: none;
transition: border-color 0.15s, color 0.15s; transition:
border-color 0.15s,
color 0.15s;
} }
.pagination-btn:hover:not(.disabled) { .pagination-btn:hover:not(.disabled) {
+17 -11
View File
@@ -21,10 +21,16 @@ form[role="search"]:not(.header-search-form) {
.header-search-wrap { .header-search-wrap {
padding: 0; padding: 0;
flex-shrink: 0; flex-shrink: 0;
background: linear-gradient(180deg, rgba(192, 93, 225, 1) 0%, rgba(255, 255, 255, 1) 100%); background: linear-gradient(
180deg,
rgba(192, 93, 225, 1) 0%,
rgba(255, 255, 255, 1) 100%
);
} }
.header-search-form { width: 100%; } .header-search-form {
width: 100%;
}
.header-search-input-wrap { .header-search-input-wrap {
position: relative; position: relative;
@@ -43,18 +49,18 @@ form[role="search"]:not(.header-search-form) {
.header-search-input-wrap input { .header-search-input-wrap input {
width: 100%; width: 100%;
padding: var(--space-2xs) var(--space-s) !important; padding: var(--space-2xs) var(--space-s);
padding-left: calc(18px + var(--space-l)) !important; padding-left: calc(18px + var(--space-l));
border: 1px solid var(--accent-primary) !important; border: 1px solid var(--accent-primary);
border-radius: var(--radius) !important; border-radius: var(--radius);
background: var(--bg-primary) !important; background: var(--bg-primary);
font-size: var(--step-0) !important; font-size: var(--step-0);
color: var(--text-primary) !important; color: var(--text-primary);
font-family: inherit !important; font-family: inherit;
} }
.header-search-input-wrap input::placeholder { .header-search-input-wrap input::placeholder {
color: var(--accent-primary) !important; color: var(--accent-primary);
font-family: var(--font-body); font-family: var(--font-body);
font-weight: 300; font-weight: 300;
} }
+17 -5
View File
@@ -26,7 +26,8 @@
box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
pointer-events: auto; pointer-events: auto;
/* enter then fade out — total visible ~6.35s */ /* enter then fade out — total visible ~6.35s */
animation: toast-enter 0.35s ease-out, animation:
toast-enter 0.35s ease-out,
toast-exit 0.5s ease-in 6s forwards; toast-exit 0.5s ease-in 6s forwards;
} }
@@ -61,11 +62,22 @@
} }
@keyframes toast-enter { @keyframes toast-enter {
from { opacity: 0; transform: translateY(12px); } from {
to { opacity: 1; transform: translateY(0); } opacity: 0;
transform: translateY(12px);
}
to {
opacity: 1;
transform: translateY(0);
}
} }
@keyframes toast-exit { @keyframes toast-exit {
from { opacity: 1; } from {
to { opacity: 0; pointer-events: none; } opacity: 1;
}
to {
opacity: 0;
pointer-events: none;
}
} }
+3 -1
View File
@@ -46,7 +46,9 @@
text-decoration: none; text-decoration: none;
border-bottom: 2px solid transparent; border-bottom: 2px solid transparent;
margin-bottom: -2px; margin-bottom: -2px;
transition: color 0.2s, border-color 0.2s; transition:
color 0.2s,
border-color 0.2s;
} }
.access-req-tab:hover { .access-req-tab:hover {
+5 -5
View File
@@ -120,7 +120,7 @@
color: var(--text-primary); color: var(--text-primary);
} }
.relink-modal::backdrop { .relink-modal::backdrop {
background: rgba(0,0,0,0.5); background: rgba(0, 0, 0, 0.5);
} }
.relink-modal-header { .relink-modal-header {
display: flex; display: flex;
@@ -269,13 +269,13 @@
} }
.admin-form--full-editor #editor .n-input { .admin-form--full-editor #editor .n-input {
height: 100% !important; height: 100%;
overflow-y: auto !important; overflow-y: auto;
} }
.admin-form--full-editor #editor .n-preview { .admin-form--full-editor #editor .n-preview {
height: 100% !important; height: 100%;
overflow-y: auto !important; overflow-y: auto;
} }
.full-editor-toolbar { .full-editor-toolbar {
+15 -11
View File
@@ -33,9 +33,9 @@
/* ── Inputs, selects, textareas ──────────────────────────────────────────── */ /* ── Inputs, selects, textareas ──────────────────────────────────────────── */
.admin-form .admin-form
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not( input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(
[type="hidden"] [type="hidden"]
):not([type="submit"]), ):not([type="submit"]),
.admin-form select, .admin-form select,
.admin-form textarea, .admin-form textarea,
.admin-inline-form input[type="text"], .admin-inline-form input[type="text"],
@@ -50,9 +50,9 @@
/* ── Required-field indicators ──────────────────────────────────────────── */ /* ── Required-field indicators ──────────────────────────────────────────── */
.admin-form .admin-form
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not( input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(
[type="hidden"] [type="hidden"]
):not([type="submit"]):required, ):not([type="submit"]):required,
.admin-form select:required, .admin-form select:required,
.admin-form textarea:required { .admin-form textarea:required {
border-style: dashed; border-style: dashed;
@@ -264,7 +264,9 @@
border: 1px solid var(--border-primary); border: 1px solid var(--border-primary);
border-radius: var(--radius); border-radius: var(--radius);
padding: var(--space-3xs) var(--space-xs); padding: var(--space-3xs) var(--space-xs);
transition: color 0.15s, border-color 0.15s; transition:
color 0.15s,
border-color 0.15s;
} }
.mode-toggle:hover { .mode-toggle:hover {
@@ -1023,7 +1025,9 @@
color: var(--text-tertiary); color: var(--text-tertiary);
cursor: pointer; cursor: pointer;
flex-shrink: 0; flex-shrink: 0;
transition: background 0.15s, color 0.15s; transition:
background 0.15s,
color 0.15s;
} }
.tag-pill-remove:hover { .tag-pill-remove:hover {
@@ -1206,8 +1210,6 @@
color: var(--text-tertiary); color: var(--text-tertiary);
} }
/* ── Sticky formats fieldset ──────────────────────────────── */ /* ── Sticky formats fieldset ──────────────────────────────── */
#fieldset-formats { #fieldset-formats {
@@ -1240,7 +1242,7 @@ legend {
.licence-or-separator::before, .licence-or-separator::before,
.licence-or-separator::after { .licence-or-separator::after {
content: ''; content: "";
flex: 1; flex: 1;
height: 1px; height: 1px;
background: var(--accent-muted); background: var(--accent-muted);
@@ -1262,7 +1264,6 @@ legend {
padding: 0 var(--space-2xs); padding: 0 var(--space-2xs);
} }
/* ── Mobile-responsive layout ──────────────────────────────────────────── */ /* ── Mobile-responsive layout ──────────────────────────────────────────── */
/* Below 600px: labels stack above inputs, single-column form layout. /* Below 600px: labels stack above inputs, single-column form layout.
Touch targets meet WCAG 2.5.5 minimum (44×44px). */ Touch targets meet WCAG 2.5.5 minimum (44×44px). */
@@ -1293,7 +1294,10 @@ legend {
.admin-form select, .admin-form select,
.admin-form textarea, .admin-form textarea,
.admin-form input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="hidden"]):not([type="submit"]) { .admin-form
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not(
[type="hidden"]
):not([type="submit"]) {
min-height: 44px; min-height: 44px;
} }
+2 -2
View File
@@ -64,7 +64,7 @@
/* Media wrapper: <figure> for real images/video, <div class="card__media--gradient"> for placeholders */ /* Media wrapper: <figure> for real images/video, <div class="card__media--gradient"> for placeholders */
.home-body figure { .home-body figure {
width: 100%; width: 100%;
aspect-ratio: 4/3; aspect-ratio: 4 / 3;
overflow: hidden; overflow: hidden;
background: var(--bg-tertiary); background: var(--bg-tertiary);
position: relative; position: relative;
@@ -99,7 +99,7 @@
.card__media--gradient { .card__media--gradient {
width: 100%; width: 100%;
aspect-ratio: 4/3; aspect-ratio: 4 / 3;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
+23 -15
View File
@@ -140,12 +140,24 @@
} }
/* Flex order: years/ap/or/fi first, then keywords, students last */ /* Flex order: years/ap/or/fi first, then keywords, students last */
.repertoire-col[data-col="years"] { order: 0; } .repertoire-col[data-col="years"] {
.repertoire-col[data-col="ap"] { order: 1; } order: 0;
.repertoire-col[data-col="or"] { order: 2; } }
.repertoire-col[data-col="fi"] { order: 3; } .repertoire-col[data-col="ap"] {
.repertoire-col[data-col="kw"] { order: 4; } order: 1;
.repertoire-col[data-col="students"] { order: 5; } }
.repertoire-col[data-col="or"] {
order: 2;
}
.repertoire-col[data-col="fi"] {
order: 3;
}
.repertoire-col[data-col="kw"] {
order: 4;
}
.repertoire-col[data-col="students"] {
order: 5;
}
/* Students column: not an accordion — open results list below filters */ /* Students column: not an accordion — open results list below filters */
.repertoire-col[data-col="students"] { .repertoire-col[data-col="students"] {
@@ -293,8 +305,6 @@
} }
} }
/* ---- rep-entry: shared base (button + link variants) ---- */ /* ---- rep-entry: shared base (button + link variants) ---- */
.rep-entry { .rep-entry {
display: block; display: block;
@@ -338,7 +348,7 @@
/* Selected: accent color */ /* Selected: accent color */
.rep-entry--selected { .rep-entry--selected {
color: var(--accent-primary) !important; color: var(--accent-primary);
} }
/* Faded/disabled: muted, not interactive */ /* Faded/disabled: muted, not interactive */
@@ -430,7 +440,7 @@
.result-card__cover img { .result-card__cover img {
width: 100%; width: 100%;
aspect-ratio: 4/3; aspect-ratio: 4 / 3;
object-fit: cover; object-fit: cover;
display: block; display: block;
border-radius: 7px 7px 0 0; border-radius: 7px 7px 0 0;
@@ -438,7 +448,7 @@
.result-card__gradient { .result-card__gradient {
width: 100%; width: 100%;
aspect-ratio: 4/3; aspect-ratio: 4 / 3;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
@@ -592,7 +602,6 @@
padding: 0 var(--space-2xs); padding: 0 var(--space-2xs);
} }
/* Error message */ /* Error message */
.search-error { .search-error {
background: var(--search-error-bg); background: var(--search-error-bg);
@@ -611,7 +620,7 @@
width: 300px; width: 300px;
background: var(--bg-primary, #fff); background: var(--bg-primary, #fff);
border: 1px solid var(--border-primary, #ddd); border: 1px solid var(--border-primary, #ddd);
box-shadow: 0 4px 20px rgba(0,0,0,.13); box-shadow: 0 4px 20px rgba(0, 0, 0, 0.13);
border-radius: var(--radius); border-radius: var(--radius);
overflow: hidden; overflow: hidden;
pointer-events: auto; pointer-events: auto;
@@ -648,7 +657,6 @@
} }
.student-card__banner--gradient { .student-card__banner--gradient {
background-image: none;
background: linear-gradient( background: linear-gradient(
180deg, 180deg,
rgba(60, 133, 108, 1) 0%, rgba(60, 133, 108, 1) 0%,
@@ -742,7 +750,7 @@
} }
.search-filters-summary::after { .search-filters-summary::after {
content: ''; content: "";
display: inline-block; display: inline-block;
width: 8px; width: 8px;
height: 8px; height: 8px;
+42 -13
View File
@@ -3,12 +3,16 @@
originally used). Do not modify this file. originally used). Do not modify this file.
============================================================ */ ============================================================ */
*, ::before, ::after { *,
::before,
::after {
box-sizing: border-box; box-sizing: border-box;
} }
html { html {
font-family: system-ui, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji'; font-family:
system-ui, "Segoe UI", Roboto, Helvetica, Arial, sans-serif,
"Apple Color Emoji", "Segoe UI Emoji";
line-height: 1.15; line-height: 1.15;
-webkit-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
tab-size: 4; tab-size: 4;
@@ -18,12 +22,17 @@ body {
margin: 0; margin: 0;
} }
b, strong { b,
strong {
font-weight: bolder; font-weight: bolder;
} }
code, kbd, pre, samp { code,
font-family: ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace; kbd,
pre,
samp {
font-family:
ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
font-size: 1em; font-size: 1em;
} }
@@ -31,28 +40,40 @@ small {
font-size: 80%; font-size: 80%;
} }
sub, sup { sub,
sup {
font-size: 75%; font-size: 75%;
line-height: 0; line-height: 0;
position: relative; position: relative;
vertical-align: baseline; vertical-align: baseline;
} }
sub { bottom: -0.25em; } sub {
sup { top: -0.5em; } bottom: -0.25em;
}
sup {
top: -0.5em;
}
table { table {
border-color: currentcolor; border-color: currentcolor;
} }
button, input, optgroup, select, textarea { button,
input,
optgroup,
select,
textarea {
font-family: inherit; font-family: inherit;
font-size: 100%; font-size: 100%;
line-height: 1.15; line-height: 1.15;
margin: 0; margin: 0;
} }
[type=button], [type=reset], [type=submit], button { [type="button"],
[type="reset"],
[type="submit"],
button {
-webkit-appearance: button; -webkit-appearance: button;
} }
@@ -69,7 +90,7 @@ progress {
height: auto; height: auto;
} }
[type=search] { [type="search"] {
-webkit-appearance: textfield; -webkit-appearance: textfield;
outline-offset: -2px; outline-offset: -2px;
} }
@@ -89,12 +110,20 @@ summary {
/* Additional minimal resets not in modern-normalize */ /* Additional minimal resets not in modern-normalize */
img, svg, video, canvas, audio, iframe, embed, object { img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
display: block; display: block;
vertical-align: middle; vertical-align: middle;
} }
img, video { img,
video {
max-width: 100%; max-width: 100%;
height: auto; height: auto;
} }
+79 -32
View File
@@ -18,7 +18,9 @@
text-decoration: none; text-decoration: none;
border-bottom: 2px solid transparent; border-bottom: 2px solid transparent;
margin-bottom: -1px; margin-bottom: -1px;
transition: color .15s, border-color .15s; transition:
color 0.15s,
border-color 0.15s;
} }
.sys-tab:hover { .sys-tab:hover {
color: var(--accent-primary); color: var(--accent-primary);
@@ -52,7 +54,9 @@
padding: var(--space-3xs) var(--space-2xs); padding: var(--space-3xs) var(--space-2xs);
cursor: pointer; cursor: pointer;
white-space: nowrap; white-space: nowrap;
transition: color .15s, border-color .15s; transition:
color 0.15s,
border-color 0.15s;
} }
.sys-status-toggle:hover { .sys-status-toggle:hover {
color: var(--text-primary); color: var(--text-primary);
@@ -67,7 +71,9 @@
border-top: 1px solid var(--border-primary); border-top: 1px solid var(--border-primary);
} }
@media (max-width: 700px) { @media (max-width: 700px) {
.sys-status-meta { grid-template-columns: 1fr; } .sys-status-meta {
grid-template-columns: 1fr;
}
} }
/* ── Status cards ──────────────────────────────────────────────────────── */ /* ── Status cards ──────────────────────────────────────────────────────── */
@@ -92,7 +98,7 @@
.srv-card__name { .srv-card__name {
font-size: var(--step--1); font-size: var(--step--1);
text-transform: uppercase; text-transform: uppercase;
letter-spacing: .07em; letter-spacing: 0.07em;
color: var(--text-secondary); color: var(--text-secondary);
font-weight: 500; font-weight: 500;
} }
@@ -102,15 +108,31 @@
margin-top: var(--space-3xs); margin-top: var(--space-3xs);
font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
} }
.status-ok { color: var(--accent-green); font-weight: 600; font-size: var(--step--1); } .status-ok {
.status-warn { color: var(--warning); font-weight: 600; font-size: var(--step--1); } color: var(--accent-green);
.status-err { color: var(--error); font-weight: 600; font-size: var(--step--1); } font-weight: 600;
.status-unknown { color: var(--text-tertiary); font-weight: 600; font-size: var(--step--1); } font-size: var(--step--1);
}
.status-warn {
color: var(--warning);
font-weight: 600;
font-size: var(--step--1);
}
.status-err {
color: var(--error);
font-weight: 600;
font-size: var(--step--1);
}
.status-unknown {
color: var(--text-tertiary);
font-weight: 600;
font-size: var(--step--1);
}
.srv-section-title { .srv-section-title {
font-size: var(--step--1); font-size: var(--step--1);
text-transform: uppercase; text-transform: uppercase;
letter-spacing: .1em; letter-spacing: 0.1em;
color: var(--text-secondary); color: var(--text-secondary);
border-bottom: 1px solid var(--border-primary); border-bottom: 1px solid var(--border-primary);
padding-bottom: var(--space-3xs); padding-bottom: var(--space-3xs);
@@ -124,7 +146,9 @@
padding: 0; padding: 0;
} }
/* Sub-section variant: tighter bottom margin — used for PHP/disk sub-headings */ /* Sub-section variant: tighter bottom margin — used for PHP/disk sub-headings */
.srv-section-title--sub { margin-bottom: var(--space-xs); } .srv-section-title--sub {
margin-bottom: var(--space-xs);
}
/* ── PHP info grid ─────────────────────────────────────────────────────── */ /* ── PHP info grid ─────────────────────────────────────────────────────── */
.php-grid { .php-grid {
@@ -134,7 +158,9 @@
margin-bottom: var(--space-l); margin-bottom: var(--space-l);
} }
/* Flush variant: no bottom margin — used inside sys-status-meta cell */ /* Flush variant: no bottom margin — used inside sys-status-meta cell */
.php-grid--flush { margin-bottom: 0; } .php-grid--flush {
margin-bottom: 0;
}
.php-item { .php-item {
background: var(--bg-primary); background: var(--bg-primary);
border: 1px solid var(--border-primary); border: 1px solid var(--border-primary);
@@ -144,7 +170,7 @@
.php-item__key { .php-item__key {
font-size: var(--step--2); font-size: var(--step--2);
text-transform: uppercase; text-transform: uppercase;
letter-spacing: .06em; letter-spacing: 0.06em;
color: var(--text-tertiary); color: var(--text-tertiary);
} }
.php-item__val { .php-item__val {
@@ -167,7 +193,7 @@
border-radius: var(--radius); border-radius: var(--radius);
width: var(--disk-pct, 0%); width: var(--disk-pct, 0%);
background: var(--disk-color, var(--accent-green)); background: var(--disk-color, var(--accent-green));
transition: width .3s; transition: width 0.3s;
} }
.disk-stats { .disk-stats {
display: flex; display: flex;
@@ -188,23 +214,27 @@
transition: opacity 0.1s; transition: opacity 0.1s;
} }
#sys-tab-panel.htmx-request::after { #sys-tab-panel.htmx-request::after {
content: ''; content: "";
position: absolute; position: absolute;
inset: 0; inset: 0;
background: repeating-linear-gradient( background: repeating-linear-gradient(
-45deg, -45deg,
transparent, transparent,
transparent 6px, transparent 6px,
rgba(0,0,0,0.03) 6px, rgba(0, 0, 0, 0.03) 6px,
rgba(0,0,0,0.03) 12px rgba(0, 0, 0, 0.03) 12px
); );
border-radius: var(--radius); border-radius: var(--radius);
animation: sys-panel-shimmer 1s linear infinite; animation: sys-panel-shimmer 1s linear infinite;
background-size: 200% 200%; background-size: 200% 200%;
} }
@keyframes sys-panel-shimmer { @keyframes sys-panel-shimmer {
0% { background-position: 0 0; } 0% {
100% { background-position: 100% 100%; } background-position: 0 0;
}
100% {
background-position: 100% 100%;
}
} }
/* ── Log viewer ────────────────────────────────────────────────────────── */ /* ── Log viewer ────────────────────────────────────────────────────────── */
@@ -222,7 +252,9 @@
.log-toolbar select { .log-toolbar select {
padding: var(--space-3xs) var(--space-xs); padding: var(--space-3xs) var(--space-xs);
} }
.log-toolbar select:focus { outline: 2px solid var(--accent-primary); } .log-toolbar select:focus {
outline: 2px solid var(--accent-primary);
}
.log-meta { .log-meta {
font-size: var(--step--2); font-size: var(--step--2);
@@ -233,7 +265,10 @@
gap: var(--space-m); gap: var(--space-m);
flex-wrap: wrap; flex-wrap: wrap;
} }
.log-meta span::before { content: attr(data-label) ": "; opacity: .6; } .log-meta span::before {
content: attr(data-label) ": ";
opacity: 0.6;
}
.log-unavailable { .log-unavailable {
background: var(--bg-secondary); background: var(--bg-secondary);
@@ -247,12 +282,12 @@
font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
font-size: var(--step--2); font-size: var(--step--2);
margin-top: var(--space-3xs); margin-top: var(--space-3xs);
opacity: .7; opacity: 0.7;
} }
.log-unavail-dev { .log-unavail-dev {
margin-top: var(--space-2xs); margin-top: var(--space-2xs);
font-size: var(--step--2); font-size: var(--step--2);
opacity: .7; opacity: 0.7;
} }
.log-empty { .log-empty {
color: var(--text-secondary); color: var(--text-secondary);
@@ -265,7 +300,8 @@
border-radius: var(--radius); border-radius: var(--radius);
padding: var(--space-s); padding: var(--space-s);
overflow-x: auto; overflow-x: auto;
font-family: ui-monospace, "SFMono-Regular", Consolas, "Courier New", monospace; font-family:
ui-monospace, "SFMono-Regular", Consolas, "Courier New", monospace;
font-size: var(--step--2); font-size: var(--step--2);
line-height: 1.55; line-height: 1.55;
max-height: 62vh; max-height: 62vh;
@@ -279,17 +315,28 @@
border-radius: var(--radius); border-radius: var(--radius);
color: var(--text-primary); color: var(--text-primary);
} }
.log-line + .log-line { border-top: 1px solid var(--border-primary); } .log-line + .log-line {
.log-crit { color: var(--sys-syntax-crit); background: var(--error-muted-bg); } border-top: 1px solid var(--border-primary);
.log-error { color: var(--error); } }
.log-warn { color: var(--warning); } .log-crit {
.log-notice { color: var(--sys-syntax-notice); } color: var(--sys-syntax-crit);
background: var(--error-muted-bg);
}
.log-error {
color: var(--error);
}
.log-warn {
color: var(--warning);
}
.log-notice {
color: var(--sys-syntax-notice);
}
.log-line::before { .log-line::before {
content: attr(data-n); content: attr(data-n);
display: inline-block; display: inline-block;
min-width: 4ch; min-width: 4ch;
margin-right: var(--space-xs); margin-right: var(--space-xs);
opacity: .3; opacity: 0.3;
text-align: right; text-align: right;
user-select: none; user-select: none;
} }
@@ -327,7 +374,9 @@
color: var(--accent-primary); color: var(--accent-primary);
text-decoration: none; text-decoration: none;
} }
.sys-refresh-note a:hover { color: var(--accent-primary); } .sys-refresh-note a:hover {
color: var(--accent-primary);
}
/* ── Cache freshness badges ────────────────────────────────────────────── */ /* ── Cache freshness badges ────────────────────────────────────────────── */
.sys-cache-badge { .sys-cache-badge {
@@ -351,5 +400,3 @@
color: var(--success); color: var(--success);
border: 1px solid var(--success-muted-border); border: 1px solid var(--success-muted-border);
} }
+2 -2
View File
@@ -45,7 +45,7 @@
*, *,
*::before, *::before,
*::after { *::after {
transition-duration: 0.01ms !important; transition-duration: 0.01ms;
animation-duration: 0.01ms !important; animation-duration: 0.01ms;
} }
} }
@@ -4,43 +4,45 @@
* Provides: dialog openers, clipboard copy, password dialog. * Provides: dialog openers, clipboard copy, password dialog.
*/ */
(() => { (() => {
var createBtn = document.getElementById('open-create-dialog'); var createBtn = document.getElementById("open-create-dialog");
if (createBtn) { if (createBtn) {
createBtn.addEventListener('click', () => { createBtn.addEventListener("click", () => {
document.getElementById('create-dialog').showModal(); document.getElementById("create-dialog").showModal();
}); });
} }
})(); })();
var _pendingDeleteLinkId = null; var _pendingDeleteLinkId = null;
function openDeleteLinkDialog(id) { function _openDeleteLinkDialog(id) {
_pendingDeleteLinkId = id; _pendingDeleteLinkId = id;
document.getElementById('delete-link-dialog').showModal(); document.getElementById("delete-link-dialog").showModal();
} }
function _executeDeleteLink() { function _executeDeleteLink() {
var form = document.getElementById('delete-link-form-' + _pendingDeleteLinkId); var form = document.getElementById(
`delete-link-form-${_pendingDeleteLinkId}`,
);
if (form) form.submit(); if (form) form.submit();
} }
function copyUrl(id) { function _copyUrl(id) {
var input = document.getElementById('url-' + id); var input = document.getElementById(`url-${id}`);
navigator.clipboard.writeText(input.value).then(() => { navigator.clipboard.writeText(input.value).then(() => {
var btn = event.target.closest('button'); var btn = event.target.closest("button");
var orig = btn.textContent; var orig = btn.textContent;
btn.textContent = '✓ Copié'; btn.textContent = "✓ Copié";
setTimeout(() => { setTimeout(() => {
btn.textContent = orig; btn.textContent = orig;
}, 1200); }, 1200);
}); });
} }
function openPasswordDialog(id, hasPassword) { function _openPasswordDialog(id, hasPassword) {
document.getElementById('password-link-id').value = id; document.getElementById("password-link-id").value = id;
var info = document.getElementById('password-current-info'); var info = document.getElementById("password-current-info");
info.textContent = hasPassword info.textContent = hasPassword
? 'Un mot de passe est actuellement configuré. Entrez-en un nouveau ou laissez vide pour le supprimer.' ? "Un mot de passe est actuellement configuré. Entrez-en un nouveau ou laissez vide pour le supprimer."
: 'Aucun mot de passe configuré.'; : "Aucun mot de passe configuré.";
document.getElementById('password-dialog').showModal(); document.getElementById("password-dialog").showModal();
} }
+47 -41
View File
@@ -8,46 +8,49 @@
*/ */
(() => { (() => {
var baseUrlMeta = document.querySelector('meta[name="acces-base-url"]'); var baseUrlMeta = document.querySelector('meta[name="acces-base-url"]');
var passwordMeta = document.querySelector('meta[name="acces-new-link-password"]'); var passwordMeta = document.querySelector(
'meta[name="acces-new-link-password"]',
);
var slugMeta = document.querySelector('meta[name="acces-new-link-slug"]'); var slugMeta = document.querySelector('meta[name="acces-new-link-slug"]');
// Show result dialog after redirect (new link created) // Show result dialog after redirect (new link created)
if (passwordMeta && slugMeta && passwordMeta.content && slugMeta.content) { if (passwordMeta && slugMeta && passwordMeta.content && slugMeta.content) {
document.getElementById('create-result-password').value = passwordMeta.content; document.getElementById("create-result-password").value =
document.getElementById('create-result-url').value = passwordMeta.content;
(baseUrlMeta ? baseUrlMeta.content : '') + '/partage/' + slugMeta.content; document.getElementById("create-result-url").value =
document.getElementById('create-result-dialog').showModal(); `${baseUrlMeta ? baseUrlMeta.content : ""}/partage/${slugMeta.content}`;
document.getElementById("create-result-dialog").showModal();
} }
// Create dialog opener // Create dialog opener
var createBtn = document.getElementById('open-create-dialog'); var createBtn = document.getElementById("open-create-dialog");
if (createBtn) { if (createBtn) {
createBtn.addEventListener('click', () => { createBtn.addEventListener("click", () => {
document.getElementById('create-dialog').showModal(); document.getElementById("create-dialog").showModal();
}); });
} }
})(); })();
function copyUrl(id) { function _copyUrl(id) {
var input = document.getElementById('url-' + id); var input = document.getElementById(`url-${id}`);
navigator.clipboard.writeText(input.value).then(() => { navigator.clipboard.writeText(input.value).then(() => {
var btn = event.target.closest('button'); var btn = event.target.closest("button");
if (btn) { if (btn) {
var orig = btn.getAttribute('title') || ''; const orig = btn.getAttribute("title") || "";
btn.setAttribute('title', '✓ Copié'); btn.setAttribute("title", "✓ Copié");
setTimeout(() => { setTimeout(() => {
btn.setAttribute('title', orig); btn.setAttribute("title", orig);
}, 1200); }, 1200);
} }
}); });
} }
function copyUrlFrom(el) { function _copyUrlFrom(el) {
navigator.clipboard.writeText(el.value).then(() => { navigator.clipboard.writeText(el.value).then(() => {
var btn = el.nextElementSibling; const btn = el.nextElementSibling;
if (btn) { if (btn) {
var orig = btn.textContent; const orig = btn.textContent;
btn.textContent = '✓ Copié'; btn.textContent = "✓ Copié";
setTimeout(() => { setTimeout(() => {
btn.textContent = orig; btn.textContent = orig;
}, 1200); }, 1200);
@@ -55,51 +58,54 @@ function copyUrlFrom(el) {
}); });
} }
function copyTextToClipboard(text) { function _copyTextToClipboard(text) {
navigator.clipboard.writeText(text) navigator.clipboard
.writeText(text)
.then(() => { .then(() => {
var btn = event && event.target ? event.target.closest('button') : null; const btn = event?.target ? event.target.closest("button") : null;
if (btn) { if (btn) {
var orig = btn.getAttribute('title') || ''; const orig = btn.getAttribute("title") || "";
btn.setAttribute('title', '✓ Copié'); btn.setAttribute("title", "✓ Copié");
setTimeout(() => { setTimeout(() => {
btn.setAttribute('title', orig); btn.setAttribute("title", orig);
}, 1200); }, 1200);
} }
}) })
.catch(() => {}); .catch(() => {});
} }
function openEditDialog(id, name, hasPassword, expiresVal) { function _openEditDialog(id, name, _hasPassword, expiresVal) {
document.getElementById('edit-link-id').value = id; document.getElementById("edit-link-id").value = id;
document.getElementById('edit-name').value = name || ''; document.getElementById("edit-name").value = name || "";
document.getElementById('edit-expires').value = expiresVal || ''; document.getElementById("edit-expires").value = expiresVal || "";
document.getElementById('edit-dialog').showModal(); document.getElementById("edit-dialog").showModal();
} }
function openApproveDialog(requestId) { function _openApproveDialog(requestId) {
document.getElementById('approve-request-id').value = requestId; document.getElementById("approve-request-id").value = requestId;
document.getElementById('approve-dialog').showModal(); document.getElementById("approve-dialog").showModal();
} }
function openRejectDialog(requestId) { function _openRejectDialog(requestId) {
document.getElementById('reject-request-id').value = requestId; document.getElementById("reject-request-id").value = requestId;
document.getElementById('reject-dialog').showModal(); document.getElementById("reject-dialog").showModal();
} }
var _pendingArchiveLinkId = null; var _pendingArchiveLinkId = null;
function openArchiveLinkDialog(id) { function _openArchiveLinkDialog(id) {
_pendingArchiveLinkId = id; _pendingArchiveLinkId = id;
document.getElementById('archive-link-dialog').showModal(); document.getElementById("archive-link-dialog").showModal();
} }
function _executeArchiveLink() { function _executeArchiveLink() {
var form = document.getElementById('archive-link-form-' + _pendingArchiveLinkId); var form = document.getElementById(
`archive-link-form-${_pendingArchiveLinkId}`,
);
if (form) form.submit(); if (form) form.submit();
} }
function openDeleteArchivedLinkDialog(id) { function _openDeleteArchivedLinkDialog(id) {
document.getElementById('delete-archived-link-id').value = id; document.getElementById("delete-archived-link-id").value = id;
document.getElementById('delete-archived-link-dialog').showModal(); document.getElementById("delete-archived-link-dialog").showModal();
} }
+25 -20
View File
@@ -6,7 +6,8 @@
*/ */
(() => { (() => {
function cleanupToggleAll(src, group) { function cleanupToggleAll(src, group) {
const selector = group === 'filepond' const selector =
group === "filepond"
? 'input[name="filepond_dirs[]"]' ? 'input[name="filepond_dirs[]"]'
: 'input[name="trash_files[]"]'; : 'input[name="trash_files[]"]';
document.querySelectorAll(selector).forEach((cb) => { document.querySelectorAll(selector).forEach((cb) => {
@@ -16,50 +17,54 @@
} }
function cleanupUpdateBulk() { function cleanupUpdateBulk() {
const bar = document.getElementById('cleanup-bulk-actions'); const bar = document.getElementById("cleanup-bulk-actions");
const countEl = document.getElementById('cleanup-selected-count'); const countEl = document.getElementById("cleanup-selected-count");
if (!bar || !countEl) return; if (!bar || !countEl) return;
const n = document.querySelectorAll( const n = document.querySelectorAll(
'input[name="filepond_dirs[]"]:checked, input[name="trash_files[]"]:checked' 'input[name="filepond_dirs[]"]:checked, input[name="trash_files[]"]:checked',
).length; ).length;
countEl.textContent = n; countEl.textContent = n;
bar.style.display = n > 0 ? 'flex' : 'none'; bar.style.display = n > 0 ? "flex" : "none";
} }
function cleanupBulkDelete() { function cleanupBulkDelete() {
const form = document.getElementById('cleanup-bulk-form'); const form = document.getElementById("cleanup-bulk-form");
const container = document.getElementById('cleanup-bulk-checkboxes'); const container = document.getElementById("cleanup-bulk-checkboxes");
if (!form || !container) return; if (!form || !container) return;
// Populate hidden inputs from checked checkboxes // Populate hidden inputs from checked checkboxes
container.innerHTML = ''; container.innerHTML = "";
document.querySelectorAll( document
'input[name="filepond_dirs[]"]:checked, input[name="trash_files[]"]:checked' .querySelectorAll(
).forEach((cb) => { 'input[name="filepond_dirs[]"]:checked, input[name="trash_files[]"]:checked',
const inp = document.createElement('input'); )
inp.type = 'hidden'; .forEach((cb) => {
const inp = document.createElement("input");
inp.type = "hidden";
inp.name = cb.name; // "filepond_dirs[]" or "trash_files[]" inp.name = cb.name; // "filepond_dirs[]" or "trash_files[]"
inp.value = cb.value; inp.value = cb.value;
container.appendChild(inp); container.appendChild(inp);
}); });
// Submit via HTMX // Submit via HTMX
htmx.trigger(form, 'submit'); htmx.trigger(form, "submit");
} }
function reattachListeners() { function reattachListeners() {
document.querySelectorAll( document
'input[name="filepond_dirs[]"], input[name="trash_files[]"]' .querySelectorAll(
).forEach((cb) => { 'input[name="filepond_dirs[]"], input[name="trash_files[]"]',
cb.addEventListener('change', cleanupUpdateBulk); )
.forEach((cb) => {
cb.addEventListener("change", cleanupUpdateBulk);
}); });
cleanupUpdateBulk(); cleanupUpdateBulk();
} }
document.addEventListener('htmx:afterSwap', (evt) => { document.addEventListener("htmx:afterSwap", (evt) => {
// Only reattach if the swap target is our cleanup wrapper // Only reattach if the swap target is our cleanup wrapper
if (evt.detail.target.id === 'tmp-cleanup-stats-wrapper') { if (evt.detail.target.id === "tmp-cleanup-stats-wrapper") {
reattachListeners(); reattachListeners();
} }
}); });
+33 -32
View File
@@ -5,62 +5,63 @@
* Expects templates with ids `entry-template-f-{key}` and `group-template-f-{key}`. * Expects templates with ids `entry-template-f-{key}` and `group-template-f-{key}`.
*/ */
(() => { (() => {
var form = document.querySelector('form[data-apropos-key]'); var form = document.querySelector("form[data-apropos-key]");
if (!form) return; if (!form) return;
var key = form.dataset.aproposKey; var key = form.dataset.aproposKey;
var groupCount = parseInt(form.dataset.aproposGroupCount, 10) || 0; var groupCount = parseInt(form.dataset.aproposGroupCount, 10) || 0;
var entryTpl = document.getElementById('entry-template-f-' + key).innerHTML; var entryTpl = document.getElementById(`entry-template-f-${key}`).innerHTML;
var groupTpl = document.getElementById('group-template-f-' + key).innerHTML; var groupTpl = document.getElementById(`group-template-f-${key}`).innerHTML;
function reindexGroups() { function reindexGroups() {
var fieldsets = form.querySelectorAll('fieldset.apropos-group'); var fieldsets = form.querySelectorAll("fieldset.apropos-group");
groupCount = fieldsets.length; groupCount = fieldsets.length;
fieldsets.forEach((fs, i) => { fieldsets.forEach((fs, i) => {
var newIdx = i; var newIdx = i;
var legend = fs.querySelector('legend'); var legend = fs.querySelector("legend");
if (legend) legend.textContent = 'Contact ' + (newIdx + 1); if (legend) legend.textContent = `Contact ${newIdx + 1}`;
fs.querySelectorAll('input').forEach((inp) => { fs.querySelectorAll("input").forEach((inp) => {
if (inp.name) { if (inp.name) {
inp.name = inp.name.replace(/groups\[\d+\]/, 'groups[' + newIdx + ']'); inp.name = inp.name.replace(/groups\[\d+\]/, `groups[${newIdx}]`);
} }
if (inp.id) { if (inp.id) {
inp.id = inp.id.replace( inp.id = inp.id.replace(
/(group_f_contacts_|entry_f_contacts_)\d+/, /(group_f_contacts_|entry_f_contacts_)\d+/,
'$1' + newIdx `$1${newIdx}`,
); );
} }
}); });
fs.querySelectorAll('label[for]').forEach((lbl) => { fs.querySelectorAll("label[for]").forEach((lbl) => {
lbl.setAttribute( lbl.setAttribute(
'for', "for",
lbl.getAttribute('for').replace( lbl
/(group_f_contacts_|entry_f_contacts_)\d+/, .getAttribute("for")
'$1' + newIdx .replace(/(group_f_contacts_|entry_f_contacts_)\d+/, `$1${newIdx}`),
)
); );
}); });
var addBtn = fs.querySelector('.add-entry-btn-f'); var addBtn = fs.querySelector(".add-entry-btn-f");
if (addBtn) addBtn.dataset.group = newIdx; if (addBtn) addBtn.dataset.group = newIdx;
}); });
} }
function bindAddEntry(btn) { function bindAddEntry(btn) {
btn.addEventListener('click', function () { btn.addEventListener("click", function () {
var gi = parseInt(this.dataset.group); var gi = parseInt(this.dataset.group, 10);
var fieldset = this.closest('fieldset'); var fieldset = this.closest("fieldset");
var entryCount = fieldset.querySelectorAll('.apropos-entry').length; var entryCount = fieldset.querySelectorAll(".apropos-entry").length;
var html = entryTpl.replaceAll('{{gi}}', gi).replaceAll('{{ei}}', entryCount); var html = entryTpl
this.insertAdjacentHTML('beforebegin', html); .replaceAll("{{gi}}", gi)
.replaceAll("{{ei}}", entryCount);
this.insertAdjacentHTML("beforebegin", html);
}); });
} }
function bindDeleteGroup(btn) { function bindDeleteGroup(btn) {
btn.addEventListener('click', function () { btn.addEventListener("click", function () {
var fieldset = this.closest('fieldset'); var fieldset = this.closest("fieldset");
if (fieldset) { if (fieldset) {
fieldset.remove(); fieldset.remove();
reindexGroups(); reindexGroups();
@@ -69,22 +70,22 @@
} }
// Bind existing buttons // Bind existing buttons
form.querySelectorAll('.add-entry-btn-f').forEach(bindAddEntry); form.querySelectorAll(".add-entry-btn-f").forEach(bindAddEntry);
form.querySelectorAll('.delete-group-btn-f').forEach(bindDeleteGroup); form.querySelectorAll(".delete-group-btn-f").forEach(bindDeleteGroup);
form.querySelector('.add-group-btn-f').addEventListener('click', function () { form.querySelector(".add-group-btn-f").addEventListener("click", function () {
groupCount++; groupCount++;
var html = groupTpl.replaceAll('{{gi}}', groupCount); var html = groupTpl.replaceAll("{{gi}}", groupCount);
this.insertAdjacentHTML('beforebegin', html); this.insertAdjacentHTML("beforebegin", html);
var newGroup = this.previousElementSibling; var newGroup = this.previousElementSibling;
if (newGroup && newGroup.classList.contains('apropos-group')) { if (newGroup?.classList.contains("apropos-group")) {
var addBtn = newGroup.querySelector('.add-entry-btn-f'); var addBtn = newGroup.querySelector(".add-entry-btn-f");
if (addBtn) { if (addBtn) {
addBtn.dataset.group = groupCount; addBtn.dataset.group = groupCount;
bindAddEntry(addBtn); bindAddEntry(addBtn);
} }
var delBtn = newGroup.querySelector('.delete-group-btn-f'); var delBtn = newGroup.querySelector(".delete-group-btn-f");
if (delBtn) bindDeleteGroup(delBtn); if (delBtn) bindDeleteGroup(delBtn);
} }
}); });
@@ -7,17 +7,17 @@
*/ */
var _languesPendingForm = null; var _languesPendingForm = null;
function languesConfirmDelete(btn, name) { function _languesConfirmDelete(btn, name) {
_languesPendingForm = btn.closest('form'); _languesPendingForm = btn.closest("form");
document.getElementById('langues-delete-name').textContent = name; document.getElementById("langues-delete-name").textContent = name;
document.getElementById('langues-delete-dialog').showModal(); document.getElementById("langues-delete-dialog").showModal();
} }
function languesSubmitPending() { function _languesSubmitPending() {
if (_languesPendingForm) _languesPendingForm.submit(); if (_languesPendingForm) _languesPendingForm.submit();
} }
function languesToggleAll(src) { function _languesToggleAll(src) {
document.querySelectorAll('input[name="selected_langs[]"]').forEach((cb) => { document.querySelectorAll('input[name="selected_langs[]"]').forEach((cb) => {
cb.checked = src.checked; cb.checked = src.checked;
}); });
@@ -25,92 +25,107 @@ function languesToggleAll(src) {
} }
function languesUpdateBulk() { function languesUpdateBulk() {
var n = document.querySelectorAll('input[name="selected_langs[]"]:checked').length; var n = document.querySelectorAll(
document.getElementById('langues-selected-count').textContent = n; 'input[name="selected_langs[]"]:checked',
var bar = document.getElementById('langues-bulk-actions'); ).length;
var wrap = document.getElementById('langues-table-wrap'); document.getElementById("langues-selected-count").textContent = n;
var bar = document.getElementById("langues-bulk-actions");
var wrap = document.getElementById("langues-table-wrap");
var visible = n > 1; var visible = n > 1;
bar.style.display = visible ? 'flex' : 'none'; bar.style.display = visible ? "flex" : "none";
if (visible) { if (visible) {
requestAnimationFrame(() => { requestAnimationFrame(() => {
wrap.style.setProperty('--sticky-top', bar.offsetHeight + 'px'); wrap.style.setProperty("--sticky-top", `${bar.offsetHeight}px`);
}); });
} else { } else {
wrap.style.setProperty('--sticky-top', '0px'); wrap.style.setProperty("--sticky-top", "0px");
} }
} }
function languesCancelSelection() { function _languesCancelSelection() {
document.querySelectorAll('input[name="selected_langs[]"]').forEach((cb) => { document.querySelectorAll('input[name="selected_langs[]"]').forEach((cb) => {
cb.checked = false; cb.checked = false;
}); });
languesUpdateBulk(); languesUpdateBulk();
} }
function languesConfirmBulkDelete() { function _languesConfirmBulkDelete() {
var checked = document.querySelectorAll('input[name="selected_langs[]"]:checked'); var checked = document.querySelectorAll(
'input[name="selected_langs[]"]:checked',
);
if (checked.length < 1) return; if (checked.length < 1) return;
document.getElementById('langues-bulk-delete-count').textContent = checked.length; document.getElementById("langues-bulk-delete-count").textContent =
document.getElementById('langues-bulk-delete-dialog').showModal(); checked.length;
document.getElementById("langues-bulk-delete-dialog").showModal();
} }
function languesExecBulkDelete() { function _languesExecBulkDelete() {
var container = document.getElementById('langues-bulk-checkboxes'); var container = document.getElementById("langues-bulk-checkboxes");
container.innerHTML = ''; container.innerHTML = "";
document.querySelectorAll('input[name="selected_langs[]"]:checked').forEach((cb) => { document
var inp = document.createElement('input'); .querySelectorAll('input[name="selected_langs[]"]:checked')
inp.type = 'hidden'; .forEach((cb) => {
inp.name = 'selected_langs[]'; var inp = document.createElement("input");
inp.type = "hidden";
inp.name = "selected_langs[]";
inp.value = cb.value; inp.value = cb.value;
container.appendChild(inp); container.appendChild(inp);
}); });
document.getElementById('langues-bulk-form').querySelector('input[name="action"]').value = document
'delete_bulk'; .getElementById("langues-bulk-form")
document.getElementById('langues-bulk-delete-dialog').close(); .querySelector('input[name="action"]').value = "delete_bulk";
document.getElementById('langues-bulk-form').submit(); document.getElementById("langues-bulk-delete-dialog").close();
document.getElementById("langues-bulk-form").submit();
} }
function languesConfirmBulkMerge() { function _languesConfirmBulkMerge() {
var checked = document.querySelectorAll('input[name="selected_langs[]"]:checked'); var checked = document.querySelectorAll(
'input[name="selected_langs[]"]:checked',
);
if (checked.length < 2) return; if (checked.length < 2) return;
document.getElementById('langues-bulk-merge-count').textContent = checked.length; document.getElementById("langues-bulk-merge-count").textContent =
var sel = document.getElementById('langues-bulk-merge-target-select'); checked.length;
var sel = document.getElementById("langues-bulk-merge-target-select");
sel.innerHTML = '<option value="">— Choisir la destination —</option>'; sel.innerHTML = '<option value="">— Choisir la destination —</option>';
checked.forEach((cb) => { checked.forEach((cb) => {
var tr = cb.closest('tr'); var tr = cb.closest("tr");
sel.innerHTML += sel.innerHTML +=
'<option value="' + '<option value="' +
cb.value + cb.value +
'">' + '">' +
tr.querySelector('td:nth-child(2)').textContent.trim() + tr.querySelector("td:nth-child(2)").textContent.trim() +
'</option>'; "</option>";
}); });
document.getElementById('langues-bulk-merge-dialog').showModal(); document.getElementById("langues-bulk-merge-dialog").showModal();
} }
function languesExecBulkMerge() { function _languesExecBulkMerge() {
var targetId = document.getElementById('langues-bulk-merge-target-select').value; var targetId = document.getElementById(
"langues-bulk-merge-target-select",
).value;
if (!targetId) return; if (!targetId) return;
document.getElementById('langues-bulk-target').value = targetId; document.getElementById("langues-bulk-target").value = targetId;
var container = document.getElementById('langues-bulk-checkboxes'); var container = document.getElementById("langues-bulk-checkboxes");
container.innerHTML = ''; container.innerHTML = "";
document.querySelectorAll('input[name="selected_langs[]"]:checked').forEach((cb) => { document
var inp = document.createElement('input'); .querySelectorAll('input[name="selected_langs[]"]:checked')
inp.type = 'hidden'; .forEach((cb) => {
inp.name = 'selected_langs[]'; var inp = document.createElement("input");
inp.type = "hidden";
inp.name = "selected_langs[]";
inp.value = cb.value; inp.value = cb.value;
container.appendChild(inp); container.appendChild(inp);
}); });
document.getElementById('langues-bulk-merge-dialog').close(); document.getElementById("langues-bulk-merge-dialog").close();
document.getElementById('langues-bulk-form').submit(); document.getElementById("langues-bulk-form").submit();
} }
document.addEventListener('htmx:afterSwap', (evt) => { document.addEventListener("htmx:afterSwap", (evt) => {
if (evt.target.id === 'langues-table-wrap') { if (evt.target.id === "langues-table-wrap") {
document document
.querySelectorAll('input[name="selected_langs[]"]') .querySelectorAll('input[name="selected_langs[]"]')
.forEach((cb) => { .forEach((cb) => {
cb.addEventListener('change', languesUpdateBulk); cb.addEventListener("change", languesUpdateBulk);
}); });
languesUpdateBulk(); languesUpdateBulk();
} }
@@ -7,17 +7,17 @@
*/ */
var _motsclesPendingForm = null; var _motsclesPendingForm = null;
function motsclesConfirmDelete(btn, name) { function _motsclesConfirmDelete(btn, name) {
_motsclesPendingForm = btn.closest('form'); _motsclesPendingForm = btn.closest("form");
document.getElementById('motscles-delete-name').textContent = name; document.getElementById("motscles-delete-name").textContent = name;
document.getElementById('motscles-delete-dialog').showModal(); document.getElementById("motscles-delete-dialog").showModal();
} }
function motsclesSubmitPending() { function _motsclesSubmitPending() {
if (_motsclesPendingForm) _motsclesPendingForm.submit(); if (_motsclesPendingForm) _motsclesPendingForm.submit();
} }
function motsclesToggleAll(src) { function _motsclesToggleAll(src) {
document.querySelectorAll('input[name="selected_tags[]"]').forEach((cb) => { document.querySelectorAll('input[name="selected_tags[]"]').forEach((cb) => {
cb.checked = src.checked; cb.checked = src.checked;
}); });
@@ -25,92 +25,105 @@ function motsclesToggleAll(src) {
} }
function motsclesUpdateBulk() { function motsclesUpdateBulk() {
var n = document.querySelectorAll('input[name="selected_tags[]"]:checked').length; var n = document.querySelectorAll(
document.getElementById('motscles-selected-count').textContent = n; 'input[name="selected_tags[]"]:checked',
var bar = document.getElementById('motscles-bulk-actions'); ).length;
var wrap = document.getElementById('motscles-table-wrap'); document.getElementById("motscles-selected-count").textContent = n;
var bar = document.getElementById("motscles-bulk-actions");
var wrap = document.getElementById("motscles-table-wrap");
var visible = n > 1; var visible = n > 1;
bar.style.display = visible ? 'flex' : 'none'; bar.style.display = visible ? "flex" : "none";
if (visible) { if (visible) {
requestAnimationFrame(() => { requestAnimationFrame(() => {
wrap.style.setProperty('--sticky-top', bar.offsetHeight + 'px'); wrap.style.setProperty("--sticky-top", `${bar.offsetHeight}px`);
}); });
} else { } else {
wrap.style.setProperty('--sticky-top', '0px'); wrap.style.setProperty("--sticky-top", "0px");
} }
} }
function motsclesConfirmBulkMerge() { function _motsclesConfirmBulkMerge() {
var checked = document.querySelectorAll('input[name="selected_tags[]"]:checked'); var checked = document.querySelectorAll(
'input[name="selected_tags[]"]:checked',
);
if (checked.length < 2) return; if (checked.length < 2) return;
document.getElementById('motscles-bulk-merge-count').textContent = checked.length; document.getElementById("motscles-bulk-merge-count").textContent =
var sel = document.getElementById('motscles-bulk-merge-target-select'); checked.length;
var sel = document.getElementById("motscles-bulk-merge-target-select");
sel.innerHTML = '<option value="">— Choisir la destination —</option>'; sel.innerHTML = '<option value="">— Choisir la destination —</option>';
checked.forEach((cb) => { checked.forEach((cb) => {
var tr = cb.closest('tr'); var tr = cb.closest("tr");
sel.innerHTML += sel.innerHTML +=
'<option value="' + '<option value="' +
cb.value + cb.value +
'">' + '">' +
tr.querySelector('td:nth-child(2)').textContent.trim() + tr.querySelector("td:nth-child(2)").textContent.trim() +
'</option>'; "</option>";
}); });
document.getElementById('motscles-bulk-merge-dialog').showModal(); document.getElementById("motscles-bulk-merge-dialog").showModal();
} }
function motsclesExecBulkMerge() { function _motsclesExecBulkMerge() {
var targetId = document.getElementById('motscles-bulk-merge-target-select').value; var targetId = document.getElementById(
"motscles-bulk-merge-target-select",
).value;
if (!targetId) return; if (!targetId) return;
document.getElementById('motscles-bulk-target').value = targetId; document.getElementById("motscles-bulk-target").value = targetId;
var container = document.getElementById('motscles-bulk-checkboxes'); var container = document.getElementById("motscles-bulk-checkboxes");
container.innerHTML = ''; container.innerHTML = "";
document.querySelectorAll('input[name="selected_tags[]"]:checked').forEach((cb) => { document
var inp = document.createElement('input'); .querySelectorAll('input[name="selected_tags[]"]:checked')
inp.type = 'hidden'; .forEach((cb) => {
inp.name = 'selected_tags[]'; var inp = document.createElement("input");
inp.type = "hidden";
inp.name = "selected_tags[]";
inp.value = cb.value; inp.value = cb.value;
container.appendChild(inp); container.appendChild(inp);
}); });
document.getElementById('motscles-bulk-merge-dialog').close(); document.getElementById("motscles-bulk-merge-dialog").close();
document.getElementById('motscles-bulk-form').submit(); document.getElementById("motscles-bulk-form").submit();
} }
function motsclesCancelSelection() { function _motsclesCancelSelection() {
document.querySelectorAll('input[name="selected_tags[]"]').forEach((cb) => { document.querySelectorAll('input[name="selected_tags[]"]').forEach((cb) => {
cb.checked = false; cb.checked = false;
}); });
motsclesUpdateBulk(); motsclesUpdateBulk();
} }
function motsclesConfirmBulkDelete() { function _motsclesConfirmBulkDelete() {
var checked = document.querySelectorAll('input[name="selected_tags[]"]:checked'); var checked = document.querySelectorAll(
'input[name="selected_tags[]"]:checked',
);
if (checked.length < 1) return; if (checked.length < 1) return;
document.getElementById('motscles-bulk-delete-count').textContent = checked.length; document.getElementById("motscles-bulk-delete-count").textContent =
document.getElementById('motscles-bulk-delete-dialog').showModal(); checked.length;
document.getElementById("motscles-bulk-delete-dialog").showModal();
} }
function motsclesExecBulkDelete() { function _motsclesExecBulkDelete() {
var container = document.getElementById('motscles-bulk-checkboxes'); var container = document.getElementById("motscles-bulk-checkboxes");
container.innerHTML = ''; container.innerHTML = "";
document.querySelectorAll('input[name="selected_tags[]"]:checked').forEach((cb) => { document
var inp = document.createElement('input'); .querySelectorAll('input[name="selected_tags[]"]:checked')
inp.type = 'hidden'; .forEach((cb) => {
inp.name = 'selected_tags[]'; var inp = document.createElement("input");
inp.type = "hidden";
inp.name = "selected_tags[]";
inp.value = cb.value; inp.value = cb.value;
container.appendChild(inp); container.appendChild(inp);
}); });
document.getElementById('motscles-bulk-form').querySelector('input[name="action"]').value = document
'delete_bulk'; .getElementById("motscles-bulk-form")
document.getElementById('motscles-bulk-delete-dialog').close(); .querySelector('input[name="action"]').value = "delete_bulk";
document.getElementById('motscles-bulk-form').submit(); document.getElementById("motscles-bulk-delete-dialog").close();
document.getElementById("motscles-bulk-form").submit();
} }
document.addEventListener('htmx:afterSwap', (evt) => { document.addEventListener("htmx:afterSwap", (evt) => {
if (evt.target.id === 'motscles-table-wrap') { if (evt.target.id === "motscles-table-wrap") {
document document.querySelectorAll('input[name="selected_tags[]"]').forEach((cb) => {
.querySelectorAll('input[name="selected_tags[]"]') cb.addEventListener("change", motsclesUpdateBulk);
.forEach((cb) => {
cb.addEventListener('change', motsclesUpdateBulk);
}); });
motsclesUpdateBulk(); motsclesUpdateBulk();
} }
@@ -3,12 +3,12 @@
* *
* Provides: openApproveDialog, openRejectDialog. * Provides: openApproveDialog, openRejectDialog.
*/ */
function openApproveDialog(requestId) { function _openApproveDialog(requestId) {
document.getElementById('approve-request-id').value = requestId; document.getElementById("approve-request-id").value = requestId;
document.getElementById('approve-dialog').showModal(); document.getElementById("approve-dialog").showModal();
} }
function openRejectDialog(requestId) { function _openRejectDialog(requestId) {
document.getElementById('reject-request-id').value = requestId; document.getElementById("reject-request-id").value = requestId;
document.getElementById('reject-dialog').showModal(); document.getElementById("reject-dialog").showModal();
} }
+44 -39
View File
@@ -6,33 +6,36 @@
*/ */
(() => { (() => {
function toggleAll(src) { function toggleAll(src) {
document.querySelectorAll('input[name="selected_theses[]"]').forEach((cb) => { document
.querySelectorAll('input[name="selected_theses[]"]')
.forEach((cb) => {
cb.checked = src.checked; cb.checked = src.checked;
}); });
updateBulk(); updateBulk();
} }
function updateBulk() { function updateBulk() {
var b = document.getElementById('bulk-actions'); var b = document.getElementById("bulk-actions");
var c = document.getElementById('selected-count'); var c = document.getElementById("selected-count");
if (!b || !c) return; // only on thesis index page if (!b || !c) return; // only on thesis index page
var n = document.querySelectorAll('input[name="selected_theses[]"]:checked').length; var n = document.querySelectorAll(
'input[name="selected_theses[]"]:checked',
).length;
c.textContent = n; c.textContent = n;
b.style.display = n > 0 ? 'flex' : 'none'; b.style.display = n > 0 ? "flex" : "none";
document.getElementById('admin-table-wrap').style.setProperty( document
'--sticky-top', .getElementById("admin-table-wrap")
n > 0 ? b.offsetHeight + 'px' : '0px' .style.setProperty("--sticky-top", n > 0 ? `${b.offsetHeight}px` : "0px");
);
} }
function getSelectedIds() { function getSelectedIds() {
return Array.from( return Array.from(
document.querySelectorAll('input[name="selected_theses[]"]:checked') document.querySelectorAll('input[name="selected_theses[]"]:checked'),
).map((cb) => cb.value); ).map((cb) => cb.value);
} }
function confirmBulk(act) { function confirmBulk(act) {
var noSel = document.getElementById('no-selection-dialog'); var noSel = document.getElementById("no-selection-dialog");
if (!noSel) return; // only on thesis index page if (!noSel) return; // only on thesis index page
var ids = getSelectedIds(); var ids = getSelectedIds();
if (!ids.length) { if (!ids.length) {
@@ -40,28 +43,28 @@
return; return;
} }
var n = ids.length; var n = ids.length;
document.getElementById('bulk-action-input').value = act; document.getElementById("bulk-action-input").value = act;
if (act === 'delete') { if (act === "delete") {
document.getElementById('bulk-delete-count').textContent = n; document.getElementById("bulk-delete-count").textContent = n;
document.getElementById('bulk-delete-dialog').showModal(); document.getElementById("bulk-delete-dialog").showModal();
} else { } else {
document.getElementById('bulk-confirm-word').textContent = document.getElementById("bulk-confirm-word").textContent =
act === 'publish' ? 'Publier' : 'Dépublier'; act === "publish" ? "Publier" : "Dépublier";
document.getElementById('bulk-confirm-count').textContent = n; document.getElementById("bulk-confirm-count").textContent = n;
document.getElementById('bulk-confirm-dialog').showModal(); document.getElementById("bulk-confirm-dialog").showModal();
} }
} }
function execBulk() { function execBulk() {
var a = document.getElementById('bulk-action-input').value; var a = document.getElementById("bulk-action-input").value;
var f = document.getElementById('bulk-form'); var f = document.getElementById("bulk-form");
f.action = a === 'delete' ? 'actions/delete.php' : 'actions/publish.php'; f.action = a === "delete" ? "actions/delete.php" : "actions/publish.php";
var c = document.getElementById('bulk-checkboxes'); var c = document.getElementById("bulk-checkboxes");
c.innerHTML = ''; c.innerHTML = "";
getSelectedIds().forEach((id) => { getSelectedIds().forEach((id) => {
var inp = document.createElement('input'); var inp = document.createElement("input");
inp.type = 'hidden'; inp.type = "hidden";
inp.name = 'selected_theses[]'; inp.name = "selected_theses[]";
inp.value = id; inp.value = id;
c.appendChild(inp); c.appendChild(inp);
}); });
@@ -71,40 +74,42 @@
function confirmExport() { function confirmExport() {
var ids = getSelectedIds(); var ids = getSelectedIds();
if (!ids.length) { if (!ids.length) {
document.getElementById('no-selection-dialog').showModal(); document.getElementById("no-selection-dialog").showModal();
return; return;
} }
window.location.href = '/admin/actions/export.php?csv=1&ids=' + ids.join(','); window.location.href = `/admin/actions/export.php?csv=1&ids=${ids.join(",")}`;
} }
function confirmExportFiles() { function confirmExportFiles() {
var ids = getSelectedIds(); var ids = getSelectedIds();
if (!ids.length) { if (!ids.length) {
document.getElementById('no-selection-dialog').showModal(); document.getElementById("no-selection-dialog").showModal();
return; return;
} }
window.location.href = '/admin/actions/export.php?files=1&ids=' + ids.join(','); window.location.href = `/admin/actions/export.php?files=1&ids=${ids.join(",")}`;
} }
function confirmDelete(id, title) { function confirmDelete(id, title) {
var dialog = document.getElementById('delete-thesis-dialog'); var dialog = document.getElementById("delete-thesis-dialog");
if (!dialog) return; // only on thesis index page if (!dialog) return; // only on thesis index page
document.getElementById('delete-thesis-title').textContent = title; document.getElementById("delete-thesis-title").textContent = title;
dialog.showModal(); dialog.showModal();
document.getElementById('delete-dialog-confirm').onclick = () => { document.getElementById("delete-dialog-confirm").onclick = () => {
document.getElementById('delete-form-' + id).submit(); document.getElementById(`delete-form-${id}`).submit();
}; };
} }
function reattachListeners() { function reattachListeners() {
document.querySelectorAll('input[name="selected_theses[]"]').forEach((cb) => { document
cb.addEventListener('change', updateBulk); .querySelectorAll('input[name="selected_theses[]"]')
.forEach((cb) => {
cb.addEventListener("change", updateBulk);
}); });
updateBulk(); updateBulk();
} }
document.addEventListener('DOMContentLoaded', reattachListeners); document.addEventListener("DOMContentLoaded", reattachListeners);
document.addEventListener('htmx:afterSwap', reattachListeners); document.addEventListener("htmx:afterSwap", reattachListeners);
// Export to global scope for onclick handlers in HTML // Export to global scope for onclick handlers in HTML
window.toggleAll = toggleAll; window.toggleAll = toggleAll;
+38 -33
View File
@@ -10,7 +10,7 @@
*/ */
var _pendingTagForm = null; var _pendingTagForm = null;
function tagsToggleAll(src) { function _tagsToggleAll(src) {
document.querySelectorAll('input[name="selected_tags[]"]').forEach((cb) => { document.querySelectorAll('input[name="selected_tags[]"]').forEach((cb) => {
cb.checked = src.checked; cb.checked = src.checked;
}); });
@@ -18,62 +18,67 @@ function tagsToggleAll(src) {
} }
function tagsUpdateBulk() { function tagsUpdateBulk() {
var n = document.querySelectorAll('input[name="selected_tags[]"]:checked').length; var n = document.querySelectorAll(
document.getElementById('tags-selected-count').textContent = n; 'input[name="selected_tags[]"]:checked',
document.getElementById('tags-bulk-actions').style.display = n > 1 ? 'flex' : 'none'; ).length;
document.getElementById("tags-selected-count").textContent = n;
document.getElementById("tags-bulk-actions").style.display =
n > 1 ? "flex" : "none";
} }
function tagsConfirmBulkMerge() { function _tagsConfirmBulkMerge() {
var checked = document.querySelectorAll('input[name="selected_tags[]"]:checked'); var checked = document.querySelectorAll(
'input[name="selected_tags[]"]:checked',
);
if (checked.length < 2) return; if (checked.length < 2) return;
document.getElementById('bulk-merge-count').textContent = checked.length; document.getElementById("bulk-merge-count").textContent = checked.length;
var sel = document.getElementById('bulk-merge-target-select'); var sel = document.getElementById("bulk-merge-target-select");
sel.innerHTML = '<option value="">— Choisir la destination —</option>'; sel.innerHTML = '<option value="">— Choisir la destination —</option>';
checked.forEach((cb) => { checked.forEach((cb) => {
var tr = cb.closest('tr'); var tr = cb.closest("tr");
sel.innerHTML += sel.innerHTML +=
'<option value="' + '<option value="' +
cb.value + cb.value +
'">' + '">' +
tr.querySelector('.tag-name-cell').textContent.trim() + tr.querySelector(".tag-name-cell").textContent.trim() +
'</option>'; "</option>";
}); });
document.getElementById('bulk-merge-dialog').showModal(); document.getElementById("bulk-merge-dialog").showModal();
} }
function tagsExecBulkMerge() { function _tagsExecBulkMerge() {
var targetId = document.getElementById('bulk-merge-target-select').value; var targetId = document.getElementById("bulk-merge-target-select").value;
if (!targetId) return; if (!targetId) return;
document.getElementById('tags-bulk-target').value = targetId; document.getElementById("tags-bulk-target").value = targetId;
var container = document.getElementById('tags-bulk-checkboxes'); var container = document.getElementById("tags-bulk-checkboxes");
container.innerHTML = ''; container.innerHTML = "";
document.querySelectorAll('input[name="selected_tags[]"]:checked').forEach((cb) => { document
var inp = document.createElement('input'); .querySelectorAll('input[name="selected_tags[]"]:checked')
inp.type = 'hidden'; .forEach((cb) => {
inp.name = 'selected_tags[]'; var inp = document.createElement("input");
inp.type = "hidden";
inp.name = "selected_tags[]";
inp.value = cb.value; inp.value = cb.value;
container.appendChild(inp); container.appendChild(inp);
}); });
document.getElementById('bulk-merge-dialog').close(); document.getElementById("bulk-merge-dialog").close();
document.getElementById('tags-bulk-form').submit(); document.getElementById("tags-bulk-form").submit();
} }
function tagsConfirmDelete(btn, name) { function _tagsConfirmDelete(btn, name) {
_pendingTagForm = btn.closest('form'); _pendingTagForm = btn.closest("form");
document.getElementById('delete-tag-name').textContent = name; document.getElementById("delete-tag-name").textContent = name;
document.getElementById('delete-tag-dialog').showModal(); document.getElementById("delete-tag-dialog").showModal();
} }
function _submitPendingTagForm() { function _submitPendingTagForm() {
if (_pendingTagForm) _pendingTagForm.submit(); if (_pendingTagForm) _pendingTagForm.submit();
} }
document.addEventListener('htmx:afterSwap', (evt) => { document.addEventListener("htmx:afterSwap", (evt) => {
if (evt.target.id === 'tags-table-wrap') { if (evt.target.id === "tags-table-wrap") {
document document.querySelectorAll('input[name="selected_tags[]"]').forEach((cb) => {
.querySelectorAll('input[name="selected_tags[]"]') cb.addEventListener("change", tagsUpdateBulk);
.forEach((cb) => {
cb.addEventListener('change', tagsUpdateBulk);
}); });
tagsUpdateBulk(); tagsUpdateBulk();
} }
+16 -15
View File
@@ -14,15 +14,15 @@
window.__adminTocBuilt = true; window.__adminTocBuilt = true;
function build() { function build() {
var main = document.getElementById('main-content'); var main = document.getElementById("main-content");
var toc = document.getElementById('admin-toc'); var toc = document.getElementById("admin-toc");
var list = document.getElementById('admin-toc-list'); var list = document.getElementById("admin-toc-list");
if (!main || !toc || !list) return; if (!main || !toc || !list) return;
// Guard against double population // Guard against double population
if (list.children.length > 0) return; if (list.children.length > 0) return;
var sections = main.querySelectorAll('section[aria-labelledby]'); var sections = main.querySelectorAll("section[aria-labelledby]");
if (sections.length < 2) { if (sections.length < 2) {
toc.hidden = true; toc.hidden = true;
return; return;
@@ -30,16 +30,16 @@
var items = []; var items = [];
sections.forEach((sec) => { sections.forEach((sec) => {
var headingId = sec.getAttribute('aria-labelledby'); var headingId = sec.getAttribute("aria-labelledby");
var heading = document.getElementById(headingId); var heading = document.getElementById(headingId);
if (!heading) return; if (!heading) return;
if (!sec.id) sec.id = headingId; if (!sec.id) sec.id = headingId;
var a = document.createElement('a'); var a = document.createElement("a");
a.href = '#' + sec.id; a.href = `#${sec.id}`;
a.textContent = heading.textContent.trim(); a.textContent = heading.textContent.trim();
var li = document.createElement('li'); var li = document.createElement("li");
li.appendChild(a); li.appendChild(a);
list.appendChild(li); list.appendChild(li);
items.push({ section: sec, link: a }); items.push({ section: sec, link: a });
@@ -64,7 +64,7 @@
// Pass 1: sections whose top is above/at the line // Pass 1: sections whose top is above/at the line
items.forEach((item) => { items.forEach((item) => {
var top = item.section.getBoundingClientRect().top; var top = item.section.getBoundingClientRect().top;
if (top <= line && (line - top) < bestDist) { if (top <= line && line - top < bestDist) {
bestDist = line - top; bestDist = line - top;
best = item; best = item;
} }
@@ -88,8 +88,9 @@
var lastItem = items[items.length - 1]; var lastItem = items[items.length - 1];
if (lastItem !== best) { if (lastItem !== best) {
var lastTop = lastItem.section.getBoundingClientRect().top; var lastTop = lastItem.section.getBoundingClientRect().top;
var atBottom = (window.innerHeight + window.scrollY + 5) var atBottom =
>= document.documentElement.scrollHeight; window.innerHeight + window.scrollY + 5 >=
document.documentElement.scrollHeight;
if (atBottom && lastTop > line && lastTop < window.innerHeight) { if (atBottom && lastTop > line && lastTop < window.innerHeight) {
best = lastItem; best = lastItem;
} }
@@ -98,10 +99,10 @@
if (!best && items.length > 0) best = items[0]; if (!best && items.length > 0) best = items[0];
items.forEach((item) => { items.forEach((item) => {
item.link.classList.toggle('toc-active', item === best); item.link.classList.toggle("toc-active", item === best);
}); });
}, },
{ threshold: buildThresholds() } { threshold: buildThresholds() },
); );
items.forEach((item) => { items.forEach((item) => {
@@ -109,8 +110,8 @@
}); });
} }
if (document.readyState === 'loading') { if (document.readyState === "loading") {
document.addEventListener('DOMContentLoaded', build); document.addEventListener("DOMContentLoaded", build);
} else { } else {
build(); build();
} }
@@ -78,5 +78,3 @@ document.body.addEventListener("htmx:beforeRequest", (e) => {
status.className = "autosave-status autosave-status--saving"; status.className = "autosave-status autosave-status--saving";
} }
}); });
@@ -172,7 +172,7 @@
* Name: queue_order[<queueType>] for the pipe-separated order. * Name: queue_order[<queueType>] for the pipe-separated order.
*/ */
function syncOrderInput(queueType, pond) { function syncOrderInput(queueType, pond) {
if (!pond || !pond.element) return; if (!pond?.element) return;
var form = pond.element.closest("form"); var form = pond.element.closest("form");
if (!form) return; if (!form) return;
@@ -724,7 +724,9 @@
// Find the label for the TFE input (its parent group's <label>) // Find the label for the TFE input (its parent group's <label>)
var fieldGroup = tfeInput.closest(".admin-files-fieldgroup"); var fieldGroup = tfeInput.closest(".admin-files-fieldgroup");
var label = fieldGroup ? fieldGroup.querySelector("label[for='tfe-files-input']") : null; var label = fieldGroup
? fieldGroup.querySelector("label[for='tfe-files-input']")
: null;
if (checkedAny) { if (checkedAny) {
tfeInput.removeAttribute("required"); tfeInput.removeAttribute("required");
@@ -992,12 +994,12 @@
? data.error ? data.error
: typeof data === "string" : typeof data === "string"
? data ? data
: "Erreur " + status; : `Erreur ${status}`;
if (bodyEl) if (bodyEl)
bodyEl.innerHTML = '<p class="file-browser-error">Erreur : ' + msg + '</p>'; bodyEl.innerHTML = `<p class="file-browser-error">Erreur : ${msg}</p>`;
return; return;
} }
console.log("[pt-relink] success | new_id=" + data.id); console.log(`[pt-relink] success | new_id=${data.id}`);
var input = document.querySelector( var input = document.querySelector(
'.tfe-file-picker[data-queue-type="tfe"]', '.tfe-file-picker[data-queue-type="tfe"]',
@@ -1008,8 +1010,7 @@
var block = document.getElementById("format-fichiers-block"); var block = document.getElementById("format-fichiers-block");
if (block && window.htmx) { if (block && window.htmx) {
var url = "/admin/fragments/fichiers.php"; var url = "/admin/fragments/fichiers.php";
if (thesisId) if (thesisId) url += `?_thesis_id=${encodeURIComponent(thesisId)}`;
url += "?_thesis_id=" + encodeURIComponent(thesisId);
htmx.ajax("GET", url, { htmx.ajax("GET", url, {
target: "#format-fichiers-block", target: "#format-fichiers-block",
swap: "outerHTML", swap: "outerHTML",
@@ -1050,8 +1051,7 @@
.catch((err) => { .catch((err) => {
console.error("[pt-relink] fetch error", err); console.error("[pt-relink] fetch error", err);
if (bodyEl) if (bodyEl)
bodyEl.innerHTML = bodyEl.innerHTML = '<p class="file-browser-error">Erreur réseau.</p>';
'<p class="file-browser-error">Erreur réseau.</p>';
}); });
}; };
})(); })();
@@ -5,22 +5,22 @@
* receives a single integer (total minutes). * receives a single integer (total minutes).
*/ */
(() => { (() => {
var form = document.querySelector('form.admin-form'); var form = document.querySelector("form.admin-form");
if (!form) return; if (!form) return;
form.addEventListener('submit', function() { form.addEventListener("submit", () => {
var h = parseInt(document.getElementById('duration_h')?.value, 10) || 0; var h = parseInt(document.getElementById("duration_h")?.value, 10) || 0;
var m = parseInt(document.getElementById('duration_m')?.value, 10) || 0; var m = parseInt(document.getElementById("duration_m")?.value, 10) || 0;
var total = h * 60 + m; var total = h * 60 + m;
var hidden = document.getElementById('duration_minutes_hidden'); var hidden = document.getElementById("duration_minutes_hidden");
if (!hidden) { if (!hidden) {
hidden = document.createElement('input'); hidden = document.createElement("input");
hidden.type = 'hidden'; hidden.type = "hidden";
hidden.name = 'duration_minutes'; hidden.name = "duration_minutes";
hidden.id = 'duration_minutes_hidden'; hidden.id = "duration_minutes_hidden";
form.appendChild(hidden); form.appendChild(hidden);
} }
hidden.value = total > 0 ? String(total) : ''; hidden.value = total > 0 ? String(total) : "";
}); });
})(); })();
+22 -16
View File
@@ -9,15 +9,15 @@
window.addJuryRow = (listId, inputName, roleLabel) => { window.addJuryRow = (listId, inputName, roleLabel) => {
var list = document.getElementById(listId); var list = document.getElementById(listId);
if (!list) return; if (!list) return;
var n = list.querySelectorAll('.admin-jury-entry').length + 1; var n = list.querySelectorAll(".admin-jury-entry").length + 1;
var div = document.createElement('div'); var div = document.createElement("div");
div.className = 'admin-jury-entry'; div.className = "admin-jury-entry";
div.innerHTML = div.innerHTML =
'<input type="text" name="' + '<input type="text" name="' +
inputName + inputName +
'" placeholder="Nom" autocomplete="off" aria-label="' + '" placeholder="Nom" autocomplete="off" aria-label="' +
roleLabel + roleLabel +
' ' + " " +
n + n +
' \u2014 nom">' + ' \u2014 nom">' +
'<button type="button" class="btn btn--sm btn--ghost admin-btn-remove" onclick="removeJuryRow(this)" aria-label="Supprimer">' + '<button type="button" class="btn btn--sm btn--ghost admin-btn-remove" onclick="removeJuryRow(this)" aria-label="Supprimer">' +
@@ -26,41 +26,47 @@
}; };
window.removeJuryRow = (btn) => { window.removeJuryRow = (btn) => {
var entry = btn.closest('.admin-jury-entry'); var entry = btn.closest(".admin-jury-entry");
if (entry) entry.remove(); if (entry) entry.remove();
}; };
// ── ULB toggle ───────────────────────────────────────────────────────── // ── ULB toggle ─────────────────────────────────────────────────────────
var juryFieldset = document.querySelector('fieldset[data-admin-mode]'); var juryFieldset = document.querySelector("fieldset[data-admin-mode]");
var adminMode = juryFieldset ? juryFieldset.getAttribute('data-admin-mode') === '1' : false; var adminMode = juryFieldset
? juryFieldset.getAttribute("data-admin-mode") === "1"
: false;
try { try {
var finalitySelect = document.querySelector('select[name="finality"]'); var finalitySelect = document.querySelector('select[name="finality"]');
var ulbRow = document.getElementById('jury-promoteur-ulb-row'); var ulbRow = document.getElementById("jury-promoteur-ulb-row");
if (!finalitySelect || !ulbRow) return; if (!finalitySelect || !ulbRow) return;
var ulbAsterisk = document.getElementById('jury-ulb-asterisk'); var ulbAsterisk = document.getElementById("jury-ulb-asterisk");
function isApprofondiSelected() { function isApprofondiSelected() {
var opt = finalitySelect.options[finalitySelect.selectedIndex]; var opt = finalitySelect.options[finalitySelect.selectedIndex];
if (!opt) return false; if (!opt) return false;
return (opt.textContent || opt.text || '').toLowerCase().includes('approfondi'); return (opt.textContent || opt.text || "")
.toLowerCase()
.includes("approfondi");
} }
function toggleUlb() { function toggleUlb() {
var show = isApprofondiSelected(); var show = isApprofondiSelected();
ulbRow.style.display = show ? '' : 'none'; ulbRow.style.display = show ? "" : "none";
if (ulbAsterisk) ulbAsterisk.style.display = show ? '' : 'none'; if (ulbAsterisk) ulbAsterisk.style.display = show ? "" : "none";
var inputs = ulbRow.querySelectorAll('input[name="jury_promoteur_ulb_name[]"]'); var inputs = ulbRow.querySelectorAll(
'input[name="jury_promoteur_ulb_name[]"]',
);
inputs.forEach((inp, idx) => { inputs.forEach((inp, idx) => {
inp.required = adminMode ? false : show && idx === 0; inp.required = adminMode ? false : show && idx === 0;
inp.disabled = !show; inp.disabled = !show;
if (!show) inp.value = ''; if (!show) inp.value = "";
}); });
} }
finalitySelect.addEventListener('change', toggleUlb); finalitySelect.addEventListener("change", toggleUlb);
toggleUlb(); toggleUlb();
} catch (e) { } catch (e) {
console.error('jury ULB toggle:', e); console.error("jury ULB toggle:", e);
} }
})(); })();
@@ -5,25 +5,25 @@
* Reads the container id from data-search-container-id on the pill-search div. * Reads the container id from data-search-container-id on the pill-search div.
*/ */
(() => { (() => {
var pillDiv = document.querySelector('[data-search-container-id]'); var pillDiv = document.querySelector("[data-search-container-id]");
if (!pillDiv) return; if (!pillDiv) return;
var containerId = pillDiv.getAttribute('data-search-container-id'); var containerId = pillDiv.getAttribute("data-search-container-id");
var container = document.getElementById(containerId); var container = document.getElementById(containerId);
if (!container) return; if (!container) return;
var pills = container.querySelector('.tag-search-pills'); var pills = container.querySelector(".tag-search-pills");
if (!pills) return; if (!pills) return;
function check() { function check() {
var asteriskEl = document.getElementById('languages-required-asterisk'); var asteriskEl = document.getElementById("languages-required-asterisk");
if (!asteriskEl) return; if (!asteriskEl) return;
var n = pills.querySelectorAll('.tag-pill').length; var n = pills.querySelectorAll(".tag-pill").length;
var checkboxes = document.querySelectorAll( var checkboxes = document.querySelectorAll(
'#languages-fieldset input[type="checkbox"]:checked' '#languages-fieldset input[type="checkbox"]:checked',
); );
asteriskEl.innerHTML = asteriskEl.innerHTML =
n === 0 && checkboxes.length === 0 n === 0 && checkboxes.length === 0
? ' <span class="asterisk">*</span>' ? ' <span class="asterisk">*</span>'
: ''; : "";
} }
var observer = new MutationObserver(check); var observer = new MutationObserver(check);
+12 -9
View File
@@ -9,30 +9,33 @@
*/ */
(() => { (() => {
// Toast accessibility — auto-focus warning toasts // Toast accessibility — auto-focus warning toasts
document.body.addEventListener('htmx:afterSettle', (e) => { document.body.addEventListener("htmx:afterSettle", (e) => {
if (e.target && e.target.id === 'toast-region') { if (e.target && e.target.id === "toast-region") {
var warn = e.target.querySelector('.toast--warning'); var warn = e.target.querySelector(".toast--warning");
if (warn) { if (warn) {
warn.setAttribute('tabindex', '-1'); warn.setAttribute("tabindex", "-1");
warn.focus(); warn.focus();
} }
} }
}); });
// Markdown cheatsheet: remove stale dialogs before a new one arrives // Markdown cheatsheet: remove stale dialogs before a new one arrives
document.body.addEventListener('htmx:beforeRequest', (e) => { document.body.addEventListener("htmx:beforeRequest", (e) => {
if ( if (
e.detail.requestConfig && e.detail.requestConfig &&
e.detail.requestConfig.path === '/admin/markdown-cheatsheet-fragment.php' e.detail.requestConfig.path === "/admin/markdown-cheatsheet-fragment.php"
) { ) {
var old = document.getElementById('md-cheatsheet-dialog'); var old = document.getElementById("md-cheatsheet-dialog");
if (old) old.remove(); if (old) old.remove();
} }
}); });
// Markdown cheatsheet: close on backdrop (dialog element) click // Markdown cheatsheet: close on backdrop (dialog element) click
document.body.addEventListener('click', (e) => { document.body.addEventListener("click", (e) => {
if (e.target.tagName === 'DIALOG' && e.target.id === 'md-cheatsheet-dialog') { if (
e.target.tagName === "DIALOG" &&
e.target.id === "md-cheatsheet-dialog"
) {
e.target.close(); e.target.close();
} }
}); });
@@ -5,13 +5,13 @@
* On desktop, all panels close when crossing the breakpoint. * On desktop, all panels close when crossing the breakpoint.
*/ */
(() => { (() => {
var INDEX_SEL = '#repertoire-index'; var INDEX_SEL = "#repertoire-index";
var ACCORDION_SEL = '.rep-accordion'; var ACCORDION_SEL = ".rep-accordion";
var TOGGLE_SEL = '.rep-accordion__toggle'; var TOGGLE_SEL = ".rep-accordion__toggle";
var PANEL_SEL = '.rep-accordion__panel'; var PANEL_SEL = ".rep-accordion__panel";
function isMobile() { function isMobile() {
return window.matchMedia('(max-width: 1025px)').matches; return window.matchMedia("(max-width: 1025px)").matches;
} }
function initAccordions(root) { function initAccordions(root) {
@@ -22,29 +22,29 @@
if (btn.closest('[data-col="students"]')) return; if (btn.closest('[data-col="students"]')) return;
if (btn._accordionBound) return; if (btn._accordionBound) return;
btn._accordionBound = true; btn._accordionBound = true;
btn.addEventListener('click', () => { btn.addEventListener("click", () => {
var section = btn.closest(ACCORDION_SEL); var section = btn.closest(ACCORDION_SEL);
var panel = section.querySelector(PANEL_SEL); var panel = section.querySelector(PANEL_SEL);
var isOpen = btn.getAttribute('aria-expanded') === 'true'; var isOpen = btn.getAttribute("aria-expanded") === "true";
// Close all others (except students column) // Close all others (except students column)
root.querySelectorAll(ACCORDION_SEL).forEach((s) => { root.querySelectorAll(ACCORDION_SEL).forEach((s) => {
if (s.dataset.col === 'students') return; if (s.dataset.col === "students") return;
var p = s.querySelector(PANEL_SEL); var p = s.querySelector(PANEL_SEL);
var t = s.querySelector(TOGGLE_SEL); var t = s.querySelector(TOGGLE_SEL);
if (s !== section) { if (s !== section) {
t.setAttribute('aria-expanded', 'false'); t.setAttribute("aria-expanded", "false");
p.classList.remove('is-open'); p.classList.remove("is-open");
} }
}); });
// Toggle this one // Toggle this one
var nowOpen = !isOpen; var nowOpen = !isOpen;
btn.setAttribute('aria-expanded', nowOpen ? 'true' : 'false'); btn.setAttribute("aria-expanded", nowOpen ? "true" : "false");
if (nowOpen) { if (nowOpen) {
panel.classList.add('is-open'); panel.classList.add("is-open");
} else { } else {
panel.classList.remove('is-open'); panel.classList.remove("is-open");
} }
}); });
}); });
@@ -54,12 +54,8 @@
initAccordions(document); initAccordions(document);
// Re-bind after HTMX swaps (use live DOM since e.detail.target may be detached) // Re-bind after HTMX swaps (use live DOM since e.detail.target may be detached)
document.body.addEventListener('htmx:afterSwap', (e) => { document.body.addEventListener("htmx:afterSwap", (e) => {
if ( if (e.detail.target?.matches?.(INDEX_SEL)) {
e.detail.target &&
e.detail.target.matches &&
e.detail.target.matches(INDEX_SEL)
) {
var liveIndex = document.querySelector(INDEX_SEL); var liveIndex = document.querySelector(INDEX_SEL);
if (liveIndex) initAccordions(liveIndex); if (liveIndex) initAccordions(liveIndex);
} }
@@ -67,21 +63,19 @@
// Re-bind on resize crossing the breakpoint // Re-bind on resize crossing the breakpoint
var wasMobile = isMobile(); var wasMobile = isMobile();
window.addEventListener('resize', () => { window.addEventListener("resize", () => {
var nowMobile = isMobile(); var nowMobile = isMobile();
if (nowMobile !== wasMobile) { if (nowMobile !== wasMobile) {
wasMobile = nowMobile; wasMobile = nowMobile;
if (!nowMobile) { if (!nowMobile) {
// Switching to desktop — close all panels // Switching to desktop — close all panels
document document
.querySelectorAll(INDEX_SEL + ' ' + TOGGLE_SEL) .querySelectorAll(`${INDEX_SEL} ${TOGGLE_SEL}`)
.forEach((btn) => { .forEach((btn) => {
btn.setAttribute('aria-expanded', 'false'); btn.setAttribute("aria-expanded", "false");
}); });
document document.querySelectorAll(`${INDEX_SEL} ${PANEL_SEL}`).forEach((p) => {
.querySelectorAll(INDEX_SEL + ' ' + PANEL_SEL) p.classList.remove("is-open");
.forEach((p) => {
p.classList.remove('is-open');
}); });
} }
} }
@@ -8,17 +8,17 @@
* DOM replacement. * DOM replacement.
*/ */
(() => { (() => {
var INDEX_SEL = '#repertoire-index'; var INDEX_SEL = "#repertoire-index";
var scrollSnapshots = {}; var scrollSnapshots = {};
function snapshot() { function snapshot() {
var index = document.querySelector(INDEX_SEL); var index = document.querySelector(INDEX_SEL);
if (!index) return; if (!index) return;
scrollSnapshots = {}; scrollSnapshots = {};
index.querySelectorAll('.repertoire-col[data-col] > ul').forEach((ul) => { index.querySelectorAll(".repertoire-col[data-col] > ul").forEach((ul) => {
var col = ul.closest('.repertoire-col'); var col = ul.closest(".repertoire-col");
if (!col) return; if (!col) return;
var key = col.getAttribute('data-col'); var key = col.getAttribute("data-col");
scrollSnapshots[key] = ul.scrollTop; scrollSnapshots[key] = ul.scrollTop;
}); });
} }
@@ -26,10 +26,10 @@
function restore() { function restore() {
var index = document.querySelector(INDEX_SEL); var index = document.querySelector(INDEX_SEL);
if (!index) return; if (!index) return;
index.querySelectorAll('.repertoire-col[data-col] > ul').forEach((ul) => { index.querySelectorAll(".repertoire-col[data-col] > ul").forEach((ul) => {
var col = ul.closest('.repertoire-col'); var col = ul.closest(".repertoire-col");
if (!col) return; if (!col) return;
var key = col.getAttribute('data-col'); var key = col.getAttribute("data-col");
if (scrollSnapshots[key] !== undefined) { if (scrollSnapshots[key] !== undefined) {
ul.scrollTop = scrollSnapshots[key]; ul.scrollTop = scrollSnapshots[key];
} }
@@ -37,23 +37,15 @@
} }
// Capture scroll positions before the outgoing element is replaced // Capture scroll positions before the outgoing element is replaced
document.body.addEventListener('htmx:beforeSwap', (e) => { document.body.addEventListener("htmx:beforeSwap", (e) => {
if ( if (e.detail.target?.matches?.(INDEX_SEL)) {
e.detail.target &&
e.detail.target.matches &&
e.detail.target.matches(INDEX_SEL)
) {
snapshot(); snapshot();
} }
}); });
// Restore after the new content is in the DOM // Restore after the new content is in the DOM
document.body.addEventListener('htmx:afterSwap', (e) => { document.body.addEventListener("htmx:afterSwap", (e) => {
if ( if (e.detail.target?.matches?.(INDEX_SEL)) {
e.detail.target &&
e.detail.target.matches &&
e.detail.target.matches(INDEX_SEL)
) {
// Use requestAnimationFrame to ensure layout has settled // Use requestAnimationFrame to ensure layout has settled
requestAnimationFrame(() => { requestAnimationFrame(() => {
restore(); restore();
@@ -62,7 +54,7 @@
}); });
// Also restore on history navigation (browser back/forward) // Also restore on history navigation (browser back/forward)
document.body.addEventListener('htmx:historyRestore', () => { document.body.addEventListener("htmx:historyRestore", () => {
requestAnimationFrame(() => { requestAnimationFrame(() => {
restore(); restore();
}); });
@@ -5,7 +5,7 @@
* with `data-student-name` attribute. * with `data-student-name` attribute.
*/ */
(() => { (() => {
var popover = document.getElementById('student-popover'); var popover = document.getElementById("student-popover");
var currentAnchor = null; var currentAnchor = null;
function position(anchor) { function position(anchor) {
@@ -15,43 +15,43 @@
if (left + 300 > window.innerWidth + window.scrollX) { if (left + 300 > window.innerWidth + window.scrollX) {
left = r.left + window.scrollX - 312; left = r.left + window.scrollX - 312;
} }
popover.style.left = left + 'px'; popover.style.left = `${left}px`;
popover.style.top = top + 'px'; popover.style.top = `${top}px`;
} }
document.body.addEventListener( document.body.addEventListener(
'mouseenter', "mouseenter",
(e) => { (e) => {
var a = e.target.closest('[data-student-name]'); var a = e.target.closest("[data-student-name]");
if (!a) return; if (!a) return;
currentAnchor = a; currentAnchor = a;
}, },
true true,
); );
document.body.addEventListener('htmx:afterSwap', (e) => { document.body.addEventListener("htmx:afterSwap", (e) => {
if (e.detail.target !== popover) return; if (e.detail.target !== popover) return;
if (currentAnchor) position(currentAnchor); if (currentAnchor) position(currentAnchor);
popover.hidden = false; popover.hidden = false;
}); });
document.body.addEventListener( document.body.addEventListener(
'mouseleave', "mouseleave",
(e) => { (e) => {
if ( if (
!e.target.closest('[data-student-name]') && !e.target.closest("[data-student-name]") &&
!e.target.closest('#student-popover') !e.target.closest("#student-popover")
) )
return; return;
setTimeout(() => { setTimeout(() => {
if ( if (
!document.querySelector('[data-student-name]:hover') && !document.querySelector("[data-student-name]:hover") &&
!document.querySelector('#student-popover:hover') !document.querySelector("#student-popover:hover")
) { ) {
popover.hidden = true; popover.hidden = true;
} }
}, 120); }, 120);
}, },
true true,
); );
})(); })();
@@ -4,42 +4,45 @@
* Operates on #sidebar-links-form and #sidebar-link-tpl. * Operates on #sidebar-links-form and #sidebar-link-tpl.
*/ */
(() => { (() => {
var form = document.getElementById('sidebar-links-form'); var form = document.getElementById("sidebar-links-form");
var tpl = document.getElementById('sidebar-link-tpl'); var tpl = document.getElementById("sidebar-link-tpl");
if (!form || !tpl) return; if (!form || !tpl) return;
var tplHtml = tpl.innerHTML; var tplHtml = tpl.innerHTML;
function reindexLinks() { function reindexLinks() {
var rows = form.querySelectorAll('.sidebar-link-row'); var rows = form.querySelectorAll(".sidebar-link-row");
rows.forEach((row, i) => { rows.forEach((row, i) => {
row.querySelectorAll('input').forEach((inp) => { row.querySelectorAll("input").forEach((inp) => {
if (inp.name) { if (inp.name) {
inp.name = inp.name.replace(/links\[\d+\]/, 'links[' + i + ']'); inp.name = inp.name.replace(/links\[\d+\]/, `links[${i}]`);
} }
if (inp.id) { if (inp.id) {
inp.id = inp.id.replace(/sl_\d+/, 'sl_' + i); inp.id = inp.id.replace(/sl_\d+/, `sl_${i}`);
} }
}); });
row.querySelectorAll('label[for]').forEach((lbl) => { row.querySelectorAll("label[for]").forEach((lbl) => {
lbl.setAttribute('for', lbl.getAttribute('for').replace(/sl_\d+/, 'sl_' + i)); lbl.setAttribute(
"for",
lbl.getAttribute("for").replace(/sl_\d+/, `sl_${i}`),
);
}); });
}); });
} }
// Event delegation for remove buttons // Event delegation for remove buttons
form.addEventListener('click', (e) => { form.addEventListener("click", (e) => {
if (!e.target.closest('.remove-sidebar-link-btn')) return; if (!e.target.closest(".remove-sidebar-link-btn")) return;
e.preventDefault(); e.preventDefault();
e.target.closest('.sidebar-link-row').remove(); e.target.closest(".sidebar-link-row").remove();
reindexLinks(); reindexLinks();
}); });
// Add button // Add button
var addBtn = document.getElementById('add-sidebar-link-btn'); var addBtn = document.getElementById("add-sidebar-link-btn");
addBtn.addEventListener('click', function () { addBtn.addEventListener("click", function () {
var rows = form.querySelectorAll('.sidebar-link-row'); var rows = form.querySelectorAll(".sidebar-link-row");
var idx = rows.length; var idx = rows.length;
var html = tplHtml.split('{{li}}').join(idx); var html = tplHtml.split("{{li}}").join(idx);
this.insertAdjacentHTML('beforebegin', html); this.insertAdjacentHTML("beforebegin", html);
}); });
})(); })();
+3 -3
View File
@@ -3,11 +3,11 @@
* error. Reads the field id from data-smtp-error-field on the SMTP form. * error. Reads the field id from data-smtp-error-field on the SMTP form.
*/ */
(() => { (() => {
var form = document.querySelector('form[data-smtp-error-field]'); var form = document.querySelector("form[data-smtp-error-field]");
if (!form) return; if (!form) return;
var fieldId = form.getAttribute('data-smtp-error-field'); var fieldId = form.getAttribute("data-smtp-error-field");
var el = fieldId ? document.getElementById(fieldId) : null; var el = fieldId ? document.getElementById(fieldId) : null;
if (!el) return; if (!el) return;
el.scrollIntoView({ behavior: 'smooth', block: 'center' }); el.scrollIntoView({ behavior: "smooth", block: "center" });
el.focus(); el.focus();
})(); })();
-3
View File
@@ -47,9 +47,6 @@ class FormBootstrap
if (is_array($formData[$key])) { if (is_array($formData[$key])) {
return $formData[$key]; return $formData[$key];
} }
if ($formData[$key] === null) {
return $default;
}
return htmlspecialchars((string)$formData[$key]); return htmlspecialchars((string)$formData[$key]);
}; };
} }
+7 -1
View File
@@ -24,7 +24,13 @@
"linter": { "linter": {
"enabled": true, "enabled": true,
"rules": { "rules": {
"recommended": true "recommended": true,
"style": {
"noDescendingSpecificity": "off"
},
"correctness": {
"noInnerDeclarations": "off"
}
} }
}, },
"formatter": { "formatter": {
+1 -1
View File
@@ -470,7 +470,7 @@ lint:
[group('test')] [group('test')]
fix: fix:
# Auto-fix: biome (JS/CSS formatting + lint) + php-cs-fixer (PHP coding standards) # Auto-fix: biome (JS/CSS formatting + lint) + php-cs-fixer (PHP coding standards)
@npx biome check --write app/public/assets/css/ app/public/assets/js/app/ scripts/ @npx biome check --write --unsafe app/public/assets/css/ app/public/assets/js/app/ scripts/
@vendor/bin/php-cs-fixer fix --no-interaction @vendor/bin/php-cs-fixer fix --no-interaction
# ============================================================================ # ============================================================================
+12
View File
@@ -6,6 +6,18 @@ parameters:
count: 1 count: 1
path: app/src/Controllers/SearchController.php path: app/src/Controllers/SearchController.php
-
message: '#^Offset ''duration_minutes'' on array\{\}\|array\{license_id\: int\|null, access_type_id\: int\|null, context_note\: string, contact_visible\: int\|null\} on left side of \?\? does not exist\.$#'
identifier: nullCoalesce.offset
count: 1
path: app/src/Controllers/ThesisEditController.php
-
message: '#^Offset ''duration_pages'' on array\{\}\|array\{license_id\: int\|null, access_type_id\: int\|null, context_note\: string, contact_visible\: int\|null\} on left side of \?\? does not exist\.$#'
identifier: nullCoalesce.offset
count: 1
path: app/src/Controllers/ThesisEditController.php
- -
message: '#^Property Dispatcher\:\:\$queryParams is never read, only written\.$#' message: '#^Property Dispatcher\:\:\$queryParams is never read, only written\.$#'
identifier: property.onlyWritten identifier: property.onlyWritten
+4 -3
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env node #!/usr/bin/env node
/** /**
* Build CSS bundles with Lightning CSS. * Build CSS bundles with Lightning CSS.
* *
@@ -13,10 +14,10 @@
* Output: app/public/assets/dist/ * Output: app/public/assets/dist/
*/ */
import { bundleAsync } from "lightningcss"; import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
import { readFileSync, writeFileSync, mkdirSync } from "node:fs"; import { dirname, resolve } from "node:path";
import { resolve, dirname, basename } from "node:path";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import { bundleAsync } from "lightningcss";
const __dirname = dirname(fileURLToPath(import.meta.url)); const __dirname = dirname(fileURLToPath(import.meta.url));
const root = resolve(__dirname, ".."); const root = resolve(__dirname, "..");
+4 -3
View File
@@ -1,4 +1,5 @@
#!/usr/bin/env node #!/usr/bin/env node
/** /**
* Build JS bundles: one self-contained file per entry point. * Build JS bundles: one self-contained file per entry point.
* *
@@ -6,10 +7,10 @@
* Output: app/public/assets/dist/{admin,public,form,partage}.min.js * Output: app/public/assets/dist/{admin,public,form,partage}.min.js
*/ */
import { rolldown } from "rolldown"; import { mkdirSync, writeFileSync } from "node:fs";
import { resolve, dirname } from "node:path"; import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import { writeFileSync, mkdirSync } from "node:fs"; import { rolldown } from "rolldown";
const __dirname = dirname(fileURLToPath(import.meta.url)); const __dirname = dirname(fileURLToPath(import.meta.url));
const root = resolve(__dirname, ".."); const root = resolve(__dirname, "..");
+1 -1
View File
@@ -12,7 +12,7 @@
import { execSync } from "node:child_process"; import { execSync } from "node:child_process";
import { existsSync } from "node:fs"; import { existsSync } from "node:fs";
import { resolve, dirname } from "node:path"; import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url)); const __dirname = dirname(fileURLToPath(import.meta.url));
+2 -2
View File
@@ -6,8 +6,8 @@
* Staleness: any source file newer than the oldest dist file. * Staleness: any source file newer than the oldest dist file.
*/ */
import { statSync, existsSync, readdirSync } from "node:fs"; import { existsSync, readdirSync, statSync } from "node:fs";
import { resolve, dirname } from "node:path"; import { dirname, resolve } from "node:path";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
const __dirname = dirname(fileURLToPath(import.meta.url)); const __dirname = dirname(fileURLToPath(import.meta.url));