bouton tout-voir
This commit is contained in:
@@ -396,6 +396,42 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
});
|
||||
////////////////// end boutons media ////////////////
|
||||
|
||||
////////////////// start bouton "Tout voir" ////////////////
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
const toutVoirButtons = document.querySelectorAll('.tout-voir');
|
||||
|
||||
toutVoirButtons.forEach(button => {
|
||||
button.addEventListener('click', function () {
|
||||
const tid = this.dataset.tid;
|
||||
const select = document.getElementById('edit-field-type-de-ressource-target-id');
|
||||
|
||||
if (!select) return;
|
||||
|
||||
const optionExists = Array.from(select.options).some(o => o.value === tid);
|
||||
if (!optionExists) {
|
||||
alert("Le type de ressource sélectionné n’est pas disponible.");
|
||||
return;
|
||||
}
|
||||
|
||||
select.value = tid;
|
||||
select.dispatchEvent(new Event('change'));
|
||||
|
||||
const form = select.closest('form');
|
||||
if (form) {
|
||||
const submitButton = form.querySelector('input[type="submit"]');
|
||||
if (submitButton) {
|
||||
submitButton.click();
|
||||
} else {
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
////////////////// end bouton "Tout voir" ////////////////
|
||||
|
||||
|
||||
|
||||
////////////// start croix clear input recherche ////////////
|
||||
|
||||
Reference in New Issue
Block a user