diff --git a/src/includes/entrepreneur/components/header.pug b/src/includes/entrepreneur/components/header.pug index 090a10c20a9ee3b5a1f19d9ca1d286e6e1608d65..0d8afb85b604d58e289b17751de5a1ab5a099c1a 100644 --- a/src/includes/entrepreneur/components/header.pug +++ b/src/includes/entrepreneur/components/header.pug @@ -8,11 +8,11 @@ div.flex.flex_espace.flex_item_center sib-form.languageChoice( - data-src=`${endpoints.languages}` + data-src=`${endpoints.interfacelanguages}` fields='languages' - range-languages=`${endpoints.languages}` + range-languages=`${endpoints.interfacelanguages}` widget-languages='sib-form-dropdown' - selected-languages=`${endpoints.languages}/1/` + selected-languages=`${endpoints.interfacelanguages}/1/` label-languages='' naked ) diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index 63419cdf47818405f2532061f7a96647a8293b8d..1227d5f16abec247455ad663532647da09c168cd 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -214,36 +214,39 @@ function selectHiddenManagementForType(tab, form) { /** * Init type to type 1 */ -// function InitManagementForType() { -// var forms = document.querySelectorAll(".resource_by_step"); - -// forms.forEach(form => { -// form.addEventListener( -// "populate", -// e => { -// window.setTimeout(() => { -// let type_hidden_field = form.querySelectorAll('select[name="type"]'); -// type_hidden_field.forEach(function(select_hidden) { -// options_hidden = select_hidden.getElementsByTagName("option"); -// for (let option_hidden of options_hidden) { -// option_hidden.removeAttribute("selected"); -// if (option_hidden.value == '{"@id": "http://localhost:8000/types/1/"}') { -// //Actually selecting the option if it is the good one -// option_hidden.setAttribute("selected", "selected"); -// select_hidden.setAttribute("value", option_hidden.value); -// } -// } -// //Trigerring a reload of the associated form -// let parent_form = select_hidden.closest("sib-form"); -// parent_form.component.inputChange(); -// refreshPagination(); -// }); -// }); -// }, -// 3000 -// ); -// }); -// } +function InitManagementForType() { + var forms = document.querySelectorAll(".resource_by_step"); + + forms.forEach(form => { + form.addEventListener( + "populate", + e => { + window.setTimeout(() => { + let type_hidden_field = form.querySelectorAll('select[name="type"]'); + type_hidden_field.forEach(function(select_hidden) { + options_hidden = select_hidden.getElementsByTagName("option"); + for (let option_hidden of options_hidden) { + option_hidden.removeAttribute("selected"); + str = option_hidden.value + + if (str.substr(str.length - 10) == 'types/1/"}') { + + //Actually selecting the option if it is the good one + option_hidden.setAttribute("selected", "selected"); + select_hidden.setAttribute("value", option_hidden.value); + } + } + //Trigerring a reload of the associated form + let parent_form = select_hidden.closest("sib-form"); + parent_form.component.inputChange(); + refreshPagination(); + }); + }); + }, + 3000 + ); + }); +} /** * Manage the report broken links hidden form @@ -354,7 +357,7 @@ function manageSelectLanguage() { var base_url = location.host //If the selected language is french - if (uriLanguage === '{"@id": "http://localhost:8000/languages/1/"}') { + if (uriLanguage === '{"@id": "http://localhost:8000/interfacelanguages/1/"}') { //Redirection with the appropriate prefixe. var redirect = "http://"+base_url+'/fr/'+pathAfterThePrefix @@ -362,7 +365,6 @@ function manageSelectLanguage() { } else { var redirect = "http://"+base_url+'/en/'+pathAfterThePrefix document.location.href = redirect - } }) @@ -728,7 +730,7 @@ jQuery(document).ready(function($) { refreshPagination(); //init the fitering by step - // InitManagementForType(); + InitManagementForType(); // Get the element with id="defaultOpen" and click on it document.getElementById("defaultOpen").click();