From 5f682a637b33d7847dcea06b049376e8fa0b42dd Mon Sep 17 00:00:00 2001 From: Valentin Le Moign Date: Mon, 6 Jul 2026 18:55:37 +0200 Subject: [PATCH] =?UTF-8?q?Axes=20group=C3=A9s=20par=20p=C3=A9riode=20sur?= =?UTF-8?q?=20les=20profils=20utilisateur=20+=20fix=20soulignement=20des?= =?UTF-8?q?=20titres=20de=20cards=20li=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- css/admin.css | 20 ++++++++++++++-- css/style.css | 4 ++++ inc/assets.php | 2 ++ js/admin/admin-base.js | 46 ++++++++++++++++++++++++++++++++++++- js/admin/admin-post-edit.js | 39 +++---------------------------- js/admin/admin-profile.js | 33 ++++++++++++++++++++++++++ scss/_single.scss | 11 +++++++++ 7 files changed, 116 insertions(+), 39 deletions(-) diff --git a/css/admin.css b/css/admin.css index b84105e..03e0366 100644 --- a/css/admin.css +++ b/css/admin.css @@ -97,7 +97,10 @@ body.pods-modal-window #pods-meta-documents-joints { /* Axes thématiques checkbox group headers */ body.post-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label, -body.post-new-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label { +body.post-new-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label, +body.profile-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label, +body.user-edit-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label, +body.user-new-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; @@ -112,11 +115,24 @@ body.post-new-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label { width: 100%; } body.post-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label:first-child, -body.post-new-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label:first-child { +body.post-new-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label:first-child, +body.profile-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label:first-child, +body.user-edit-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label:first-child, +body.user-new-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label:first-child { border-top: none; margin-top: 0; } +/* Sur user-new.php, WP core force `#createuser .form-field input { width: 25em }`. + Les cases à cocher / radios des champs Pods (ex. axes) héritent de cette + largeur : on la réinitialise. */ +#adduser .form-field input[type="checkbox"], +#adduser .form-field input[type="radio"], +#createuser .form-field input[type="checkbox"], +#createuser .form-field input[type="radio"] { + width: auto; +} + /* Remove WP's JS-injected padding-top on the editor wrap (compensation for sticky toolbar) */ body.post-php #wp-content-editor-tools, body.post-new-php #wp-content-editor-tools { diff --git a/css/style.css b/css/style.css index 2ab1be0..8d956ab 100755 --- a/css/style.css +++ b/css/style.css @@ -2131,6 +2131,10 @@ footer { font-size: 1.25rem; } .article .main-content-text a { text-decoration: underline; } + .article .main-content-text .post-card h2::after { + display: none; } + .article .main-content-text .post-card a { + text-decoration: none; } .article .main-content-text p { margin-bottom: 1rem; line-height: 1.4; } diff --git a/inc/assets.php b/inc/assets.php index 7270407..d749f4e 100644 --- a/inc/assets.php +++ b/inc/assets.php @@ -274,6 +274,8 @@ function enqueue_admin_js() { // profile.php / user-edit.php / user-new.php if ( in_array( $screen->base, [ 'profile', 'user-edit', 'user' ], true ) ) { $enqueue( 'thalim-admin-profile', 'admin-profile.js', [ 'jquery', 'thalim-admin-base' ] ); + // Regroupement des axes par période (mêmes données que la page post) + wp_localize_script( 'thalim-admin-profile', 'thalimAxesGroups', thalim_get_axes_filter_groups() ); } // edit-tags.php / term.php diff --git a/js/admin/admin-base.js b/js/admin/admin-base.js index ae29fc5..0af504f 100644 --- a/js/admin/admin-base.js +++ b/js/admin/admin-base.js @@ -63,7 +63,9 @@ } function isProfileEditPage() { - return window.pagenow === 'profile' || window.pagenow === 'user-edit' || window.pagenow === 'user-new'; + // NB : sur user-new.php, window.pagenow vaut 'user' (et non 'user-new'). + return window.pagenow === 'profile' || window.pagenow === 'user-edit' + || window.pagenow === 'user-new' || window.pagenow === 'user'; } function getProfileForm() { @@ -388,6 +390,47 @@ setTimeout(markReady, 2000); }); + // Regroupe les cases à cocher du champ « axes thématiques » par période. + // Partagé entre la page d'édition de post et la page de profil (les deux + // affichent le champ en checkbox). Données via window.thalimAxesGroups + // (localisées par inc/assets.php). Idempotent : ne fait rien si déjà groupé. + function groupAxesCheckboxes() { + if (!window.thalimAxesGroups || !thalimAxesGroups.length) return; + + var row = document.querySelector('.' + CONFIG.rows.axes); + if (!row) return; + + var list = row.querySelector('ul'); + if (!list) return; + + // Already grouped — nothing to do + if (list.querySelector('.axes-group-label')) return; + + // Map existing
  • by checkbox value; preserve "add new" button + var liMap = {}; + var addNewItem = null; + list.querySelectorAll('li').forEach(function(li) { + if (li.classList.contains('pods-pick-add-new')) { addNewItem = li; return; } + var cb = li.querySelector('input[type="checkbox"]'); + if (cb) liMap[cb.value] = li; + }); + + // Rebuild list in group order + list.innerHTML = ''; + thalimAxesGroups.forEach(function(group) { + var labelLi = document.createElement('li'); + labelLi.className = 'axes-group-label'; + labelLi.textContent = group.label; + list.appendChild(labelLi); + group.terms.forEach(function(term) { + var li = liMap[String(term.id)]; + if (li) list.appendChild(li); + }); + }); + + if (addNewItem) list.appendChild(addNewItem); + } + window.ThalimAdmin = { CONFIG: CONFIG, safeRun: safeRun, @@ -399,6 +442,7 @@ reinitEditor: reinitEditor, updatePostboxVisibility: updatePostboxVisibility, initInfoPopovers: initInfoPopovers, + groupAxesCheckboxes: groupAxesCheckboxes, markReady: markReady }; diff --git a/js/admin/admin-post-edit.js b/js/admin/admin-post-edit.js index 1135506..18a1862 100644 --- a/js/admin/admin-post-edit.js +++ b/js/admin/admin-post-edit.js @@ -94,42 +94,9 @@ TA.ensureVisualMode(enEditorId); } - function groupAxesCheckboxes() { - if (!window.thalimAxesGroups || !thalimAxesGroups.length) return; - - var row = document.querySelector('.' + CONFIG.rows.axes); - if (!row) return; - - var list = row.querySelector('ul'); - if (!list) return; - - // Already grouped — nothing to do - if (list.querySelector('.axes-group-label')) return; - - // Map existing
  • by checkbox value; preserve "add new" button - var liMap = {}; - var addNewItem = null; - list.querySelectorAll('li').forEach(function(li) { - if (li.classList.contains('pods-pick-add-new')) { addNewItem = li; return; } - var cb = li.querySelector('input[type="checkbox"]'); - if (cb) liMap[cb.value] = li; - }); - - // Rebuild list in group order - list.innerHTML = ''; - thalimAxesGroups.forEach(function(group) { - var labelLi = document.createElement('li'); - labelLi.className = 'axes-group-label'; - labelLi.textContent = group.label; - list.appendChild(labelLi); - group.terms.forEach(function(term) { - var li = liMap[String(term.id)]; - if (li) list.appendChild(li); - }); - }); - - if (addNewItem) list.appendChild(addNewItem); - } + // Regroupement des axes par période — implémentation partagée dans + // admin-base.js (réutilisée par la page de profil). + var groupAxesCheckboxes = TA.groupAxesCheckboxes; var REF_BIB_EDITOR_ID = CONFIG.editors.refBib; var refBibReinited = false; diff --git a/js/admin/admin-profile.js b/js/admin/admin-profile.js index f20e40b..1ed230d 100644 --- a/js/admin/admin-profile.js +++ b/js/admin/admin-profile.js @@ -110,9 +110,42 @@ }); } + // Regroupe les axes thématiques par période (champ en cases à cocher, comme + // la page post — implémentation partagée dans admin-base.js). Les checkboxes + // sont rendues par le DFV React de façon asynchrone ; sur user-new.php, la + // page est très lourde (beaucoup de champs Pods) et le rendu peut arriver + // bien après le chargement. On observe donc le formulaire jusqu'à ce que les + // cases apparaissent, plutôt qu'un retry borné qui expirait sur user-new. + function groupProfileAxes() { + function tryGroup() { + var row = document.querySelector('.' + TA.CONFIG.rows.axes); + var list = row && row.querySelector('ul'); + if (!list) return false; + if (list.querySelector('.axes-group-label')) return true; // déjà groupé + if (!list.querySelector('input[type="checkbox"]')) return false; // pas encore rendu + TA.groupAxesCheckboxes(); + return true; + } + + if (tryGroup()) return; + + // On observe la LIGNE du champ (le