diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index b4b09ef216041c1611e9f96d2723aad6dbb35c96..dd595f608552fc3846ab84e8ee03c104da9ce347 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -148,7 +148,6 @@ function addProperFilterToSearchComponents(targetId) { var forms = baseElement.querySelectorAll(".resource_by_step"); forms.forEach(form => { form.addEventListener("populate", e => { - //Manage fake tabs let tabs = baseElement.getElementsByClassName("filter_by_type"); for (let tab of tabs) { @@ -163,7 +162,9 @@ function addProperFilterToSearchComponents(targetId) { //https://git.happy-dev.fr/startinblox/framework/sib-core/issues/379 //TODO: Wait for a solution to filter with multiple value with "OR" instead of "AND". let keyword_form = baseElement.querySelectorAll(".search-by-keyword")[0]; - let keyword_field = keyword_form.querySelector(`input[name="name_keyword"]`); + let keyword_field = keyword_form.querySelector( + `input[name="name_keyword"]` + ); let keyword_submit = baseElement.querySelectorAll(" .keyword_submit")[0]; let keyword_hidden_fields = baseElement.querySelectorAll( @@ -203,12 +204,9 @@ function addProperFilterToSearchComponents(targetId) { //Manage fake tabs for type let tabs = baseElement.getElementsByClassName("filter_by_type"); for (let tab of tabs) { - tab.addEventListener( - "click", - function() { - selectHiddenManagementForType(tab, form) - } - ); + tab.addEventListener("click", function() { + selectHiddenManagementForType(tab, form); + }); } //To retrieve format @@ -380,11 +378,9 @@ jQuery(document).ready(function($) { var previewImage = document.querySelectorAll( "sib-form-file input[name='preview_image']+input" ); - var previewlabel = document.querySelectorAll( - "sib-form-file div" - ); + var previewlabel = document.querySelectorAll("sib-form-file div"); for (let item of previewlabel) { - item.innerHTML="Upload a file" + item.innerHTML = "Upload a file"; } for (let item of previewImage) { @@ -396,37 +392,30 @@ jQuery(document).ready(function($) { var accRequest = document.querySelectorAll( "#requests accordion-request-resource" ); - console.log(accRequest) + console.log(accRequest); for (let i = 0; i < accRequest.length; i++) { accRequest[i].addEventListener("click", function() { /* Toggle between adding and removing the "active" class, to highlight the button that controls the panel */ //this.classList.toggle("active"); - console.log(this) - console.log("hello") - if (this.classList.contains("active") == true){ - this.classList.remove("active") + console.log(this); + console.log("hello"); + if (this.classList.contains("active") == true) { + this.classList.remove("active"); //this.nextElementSibling.querySelector("sib-form + div").style.maxHeight = "0px"; - }else{ - this.classList.add("active") + } else { + this.classList.add("active"); } - /* Toggle between hiding and showing the active panel */ var panelRequest = this.nextElementSibling; - console.log(panelRequest) - if (!this.classList.contain('active')) { + if (!this.classList.contain("active")) { panelRequest.style.maxHeight = null; - console.log("il est fermé", panelRequest.style.maxHeight) - let parent_form = this.closest("sib-display"); - parent_form.component.inputChange(); - refreshPagination(); + + refreshPagination(); } else { panelRequest.style.maxHeight = panelRequest.scrollHeight + "px"; - console.log("il est ouver") - let parent_form = this.closest("sib-display"); - parent_form.component.inputChange(); } }); }