diff --git a/src/includes/entrepreneur/resources/list.pug b/src/includes/entrepreneur/resources/list.pug index 6077c0e7b581d0044343cad879f87bc07bcbfd06..c289cc8a4f9280cc53c3a73adccf1e71195c86bf 100644 --- a/src/includes/entrepreneur/resources/list.pug +++ b/src/includes/entrepreneur/resources/list.pug @@ -77,6 +77,7 @@ container.block_list.flex.flex_espace div.button_base Make a request + //Step 1 sib-display#circles-list( data-src=`${endpoints.steps}1/`, fields='name' @@ -87,17 +88,16 @@ container.block_list.flex.flex_espace widget-name='cs-steps-header' ) - sib-display#step1.resource_by_step( + + sib-display.resource_by_step( data-src=`${endpoints.steps}1/resources/`, fields='name, author, format, publication_year, description, country, language.name, field', search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language.name, field)', search-range-format=`${endpoints.formats}` search-widget-search_for_a_resource="hidden-widget" - - - search-multiple-format='sib-form-dropdown' - search-widget-format='sib-form-auto-completion' + search-widget-more_criterias_hidden="hidden-widget" + search-widget-format='sib-form-dropdown' widget-name='cs-display-property' widget-country='cs-display-property' @@ -113,6 +113,7 @@ container.block_list.flex.flex_espace paginate-by="5" ) + //Step 2 sib-display#circles-list( data-src=`${endpoints.steps}2/`, fields='name' @@ -149,6 +150,7 @@ container.block_list.flex.flex_espace paginate-by="5" ) + //Step 3 sib-display#circles-list( data-src=`${endpoints.steps}3/`, fields='name' @@ -162,8 +164,8 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}3/resources/`, - fields='name, author, format, publication_year, description, country, language.name, field', - search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language.name, field)', + fields='name, author, format, publication_year, description, country, language.name, field', + search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language.name, field)', search-range-format=`${endpoints.formats}` @@ -186,6 +188,7 @@ container.block_list.flex.flex_espace paginate-by="5" ) + //Step 4 sib-display#circles-list( data-src=`${endpoints.steps}4/`, fields='name' @@ -223,6 +226,7 @@ container.block_list.flex.flex_espace paginate-by="5" ) + //Step 5 sib-display#circles-list( data-src=`${endpoints.steps}5/`, fields='name' diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index 430a2b4938036c86f1e19cc6f32b9ffdb0880b41..e298943a1c7f0315bf60af2dac959b574ba29355 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -137,21 +137,27 @@ jQuery(document).ready(function($) { 'hidden-widget[name="more_criterias_hidden"] select[name="format"]' ); + + //TODO: The first time the event is not call. format_field_search.onchange = function() { - console.log("format_field_search", format_field_search); + let option_selected = format_field_search.querySelector( + "option:checked" + ); + format_hidden_field.forEach(function(select_hidden) { options_hidden = select_hidden.getElementsByTagName("option"); - for (let option_hidden of options_hidden) { - option_selected = format_field_search.querySelector( - "option:checked" - ); - + //Removing the selected attribute from previous selection + option_hidden.removeAttribute("selected"); if (option_hidden.value == option_selected.value) { - console.log("option_selected", option_selected); - option_hidden.setAttribute("checked", "checked"); - console.log("option_hidden", option_hidden); + //Actually selecting the option if it is the good one + option_hidden.setAttribute("selected", "selected"); + select_hidden.setAttribute('value', option_selected.value) } + + //Trigerring a reload of the associated form + let parent_form = select_hidden.closest('sib-form'); + parent_form.component.inputChange(); } actualizePagination(); form.querySelector("sib-form").component.inputChange();