button media js

This commit is contained in:
2025-06-05 13:11:19 +02:00
parent 4147c9a8f2
commit bf30cb9724
3 changed files with 31 additions and 5 deletions
File diff suppressed because one or more lines are too long
+26
View File
@@ -289,3 +289,29 @@ document.addEventListener('DOMContentLoaded', () => {
});
// //////////////////end tronquage sous titre //////////////////
////////////////// start boutons media ////////////////
document.addEventListener("DOMContentLoaded", function () {
const mediaButtons = document.querySelectorAll('.buttons-filtres-ressources a');
mediaButtons.forEach(button => {
button.addEventListener('click', function (e) {
e.preventDefault();
// Récupérer lID media depuis lURL du bouton
const url = new URL(button.href);
const mediaID = url.searchParams.get('field_type_de_media_target_id');
// Appliquer la valeur dans le <select>
const select = document.getElementById('edit-field-type-de-media-target-id');
if (select) {
select.value = mediaID;
// Simuler le clic sur le bouton "Appliquer"
const submit = document.querySelector('input#edit-submit-base-de-donnees');
if (submit) {
submit.click();
}
}
});
});
});
@@ -13,7 +13,7 @@
*/
#}
<div class="buttons-filtres-ressources">
{# <div class="buttons-filtres-ressources">
<a class=" button button-videos" style="" href="https://stage.eql.figli.io/ressources?field_type_de_media_target_id=693&field_type_de_ressource_target_id=All&field_mots_clefs_target_id=All&field_date_de_parution_value=&combine="> Vidéos</a>
<a class="button button-podcasts" style="" href="https://stage.eql.figli.io/ressources?field_type_de_media_target_id=698&field_type_de_ressource_target_id=All&field_mots_clefs_target_id=All&field_date_de_parution_value=&combine="> Podcasts</a>
@@ -22,9 +22,9 @@
<a class="button button-livres" style="" href="https://stage.eql.figli.io/ressources?field_type_de_media_target_id=696&field_type_de_ressource_target_id=All&field_mots_clefs_target_id=All&field_date_de_parution_value=&combine="> Livres</a>
<a class="button button-articles" style="" href="https://stage.eql.figli.io/ressources?field_type_de_media_target_id=694&field_type_de_ressource_target_id=All&field_mots_clefs_target_id=All&field_date_de_parution_value=&combine="> Articles</a>
<a class="button button-publications-rapports" style="" href="https://stage.eql.figli.io/ressources?field_type_de_media_target_id=696&field_type_de_ressource_target_id=All&field_mots_clefs_target_id=All&field_date_de_parution_value=&combine="> Publications/rapports</a>
</div>
</div> #}
{#
<div class="buttons-filtres-ressources">
{% for item in media_links %}
<a
@@ -35,7 +35,7 @@
</a>
{% endfor %}
</div> #}
</div>
<form{{ attributes }}>