Axes groupés par période sur les profils utilisateur + fix soulignement des titres de cards liées
This commit is contained in:
@@ -97,7 +97,10 @@ body.pods-modal-window #pods-meta-documents-joints {
|
|||||||
|
|
||||||
/* Axes thématiques checkbox group headers */
|
/* Axes thématiques checkbox group headers */
|
||||||
body.post-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label,
|
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-size: 0.72rem;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
@@ -112,11 +115,24 @@ body.post-new-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label {
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
body.post-php .pods-form-ui-row-name-axes-thematiques li.axes-group-label:first-child,
|
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;
|
border-top: none;
|
||||||
margin-top: 0;
|
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) */
|
/* Remove WP's JS-injected padding-top on the editor wrap (compensation for sticky toolbar) */
|
||||||
body.post-php #wp-content-editor-tools,
|
body.post-php #wp-content-editor-tools,
|
||||||
body.post-new-php #wp-content-editor-tools {
|
body.post-new-php #wp-content-editor-tools {
|
||||||
|
|||||||
@@ -2131,6 +2131,10 @@ footer {
|
|||||||
font-size: 1.25rem; }
|
font-size: 1.25rem; }
|
||||||
.article .main-content-text a {
|
.article .main-content-text a {
|
||||||
text-decoration: underline; }
|
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 {
|
.article .main-content-text p {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
line-height: 1.4; }
|
line-height: 1.4; }
|
||||||
|
|||||||
@@ -274,6 +274,8 @@ function enqueue_admin_js() {
|
|||||||
// profile.php / user-edit.php / user-new.php
|
// profile.php / user-edit.php / user-new.php
|
||||||
if ( in_array( $screen->base, [ 'profile', 'user-edit', 'user' ], true ) ) {
|
if ( in_array( $screen->base, [ 'profile', 'user-edit', 'user' ], true ) ) {
|
||||||
$enqueue( 'thalim-admin-profile', 'admin-profile.js', [ 'jquery', 'thalim-admin-base' ] );
|
$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
|
// edit-tags.php / term.php
|
||||||
|
|||||||
@@ -63,7 +63,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isProfileEditPage() {
|
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() {
|
function getProfileForm() {
|
||||||
@@ -388,6 +390,47 @@
|
|||||||
setTimeout(markReady, 2000);
|
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 <li> 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 = {
|
window.ThalimAdmin = {
|
||||||
CONFIG: CONFIG,
|
CONFIG: CONFIG,
|
||||||
safeRun: safeRun,
|
safeRun: safeRun,
|
||||||
@@ -399,6 +442,7 @@
|
|||||||
reinitEditor: reinitEditor,
|
reinitEditor: reinitEditor,
|
||||||
updatePostboxVisibility: updatePostboxVisibility,
|
updatePostboxVisibility: updatePostboxVisibility,
|
||||||
initInfoPopovers: initInfoPopovers,
|
initInfoPopovers: initInfoPopovers,
|
||||||
|
groupAxesCheckboxes: groupAxesCheckboxes,
|
||||||
markReady: markReady
|
markReady: markReady
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -94,42 +94,9 @@
|
|||||||
TA.ensureVisualMode(enEditorId);
|
TA.ensureVisualMode(enEditorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function groupAxesCheckboxes() {
|
// Regroupement des axes par période — implémentation partagée dans
|
||||||
if (!window.thalimAxesGroups || !thalimAxesGroups.length) return;
|
// admin-base.js (réutilisée par la page de profil).
|
||||||
|
var groupAxesCheckboxes = TA.groupAxesCheckboxes;
|
||||||
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 <li> 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
var REF_BIB_EDITOR_ID = CONFIG.editors.refBib;
|
var REF_BIB_EDITOR_ID = CONFIG.editors.refBib;
|
||||||
var refBibReinited = false;
|
var refBibReinited = false;
|
||||||
|
|||||||
@@ -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 <ul> des cases y est injecté par React)
|
||||||
|
// et on NE se déconnecte PAS au premier succès : sur user-new (item id 0),
|
||||||
|
// le DFV peut re-rendre la liste après coup et écraser le groupement — on
|
||||||
|
// le réapplique alors (tryGroup est idempotent, pas de boucle). Fallback
|
||||||
|
// sur le formulaire si la ligne n'est pas encore là.
|
||||||
|
var row = document.querySelector('.' + TA.CONFIG.rows.axes);
|
||||||
|
var scope = row || TA.getProfileForm() || document.body;
|
||||||
|
var observer = new MutationObserver(function() { tryGroup(); });
|
||||||
|
observer.observe(scope, { childList: true, subtree: true });
|
||||||
|
// Filet de sécurité : cesser d'observer après 30 s.
|
||||||
|
setTimeout(function() { observer.disconnect(); }, 30000);
|
||||||
|
}
|
||||||
|
|
||||||
function initProfileEditors() {
|
function initProfileEditors() {
|
||||||
reorderProfileSections();
|
reorderProfileSections();
|
||||||
TA.initInfoPopovers('user');
|
TA.initInfoPopovers('user');
|
||||||
|
safeRun('groupProfileAxes', groupProfileAxes);
|
||||||
|
|
||||||
// Hide the "À propos du compte" section heading
|
// Hide the "À propos du compte" section heading
|
||||||
document.querySelectorAll('#your-profile h2, #adduser h2, #createuser h2').forEach(function(h2) {
|
document.querySelectorAll('#your-profile h2, #adduser h2, #createuser h2').forEach(function(h2) {
|
||||||
|
|||||||
@@ -276,6 +276,17 @@
|
|||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Les cards d'annonces liées sont imbriquées dans .main-content-text :
|
||||||
|
// leur titre est un <h2>, il ne doit hériter NI de la barre colorée
|
||||||
|
// `h2::after` (couleur de catégorie de l'annonce courante), NI du
|
||||||
|
// soulignement des liens du corps. On neutralise les deux pour les cards.
|
||||||
|
.post-card h2::after {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.post-card a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
p {
|
p {
|
||||||
margin-bottom: 1rem;
|
margin-bottom: 1rem;
|
||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
|
|||||||
Reference in New Issue
Block a user