Axes groupés par période sur les profils utilisateur + fix soulignement des titres de cards liées
This commit is contained in:
@@ -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 <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 = {
|
||||
CONFIG: CONFIG,
|
||||
safeRun: safeRun,
|
||||
@@ -399,6 +442,7 @@
|
||||
reinitEditor: reinitEditor,
|
||||
updatePostboxVisibility: updatePostboxVisibility,
|
||||
initInfoPopovers: initInfoPopovers,
|
||||
groupAxesCheckboxes: groupAxesCheckboxes,
|
||||
markReady: markReady
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user