From fbb1cdb7f66059da2f6b7440a06b74b741eb4fb2 Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Fri, 13 Sep 2019 17:28:57 +0200
Subject: [PATCH 01/13] WIP: remove pagination if useless.

---
 src/includes/entrepreneur/resources/list.pug | 31 +-------------------
 src/scripts/coopstarter.js                   | 28 ++++++++++++++----
 2 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/src/includes/entrepreneur/resources/list.pug b/src/includes/entrepreneur/resources/list.pug
index e7cb36de..6077c0e7 100644
--- a/src/includes/entrepreneur/resources/list.pug
+++ b/src/includes/entrepreneur/resources/list.pug
@@ -258,33 +258,4 @@ container.block_list.flex.flex_espace
 
         paginate-by="5"
     )
-       
-//- search-fields="keyword, instance_database_only,\
-//-         more_criterias(header_criterias, format, publication_year, country, language, field, step)"
-//-         search-label-keyword="Search by author, name..."
-//-         search-label-header_criterias='More criterias'
-//-         search-label-format='Format'
-//-         search-label-publication_year='Year of publication'
-//-         search-label-country='Country of publication'
-//-         search-label-language='Language'
-//-         search-label-field='Field'
-//-         search-label-step='Step of : Staring up a cooperative business'
-//-         search-widget-keyword="sib-form-placeholder-text"
-//-         search-widget-instance_database_only='cs-display-checkbox'
-//-         search-widget-header_criterias='cs-section_header'
-
-//-         search-range-language=`${endpoints.languages}`
-//-         search-range-field=`${endpoints.fields}`
-//-         search-range-step=`${endpoints.step}`
-
-//-         search-multiple-language='sib-multiple-select'
-//-         search-widget-language='sib-form-auto-completion'
-
-//-         search-multiple-field='sib-multiple-select'
-//-         search-widget-field='sib-form-auto-completion'
-
-//-         search-multiple-step='sib-multiple-select'
-//-         search-widget-step='sib-form-auto-completion'
-                
-//-         widget-description='cs-display-property'
-//-         widget-name='cs-display-property'
+    
diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js
index 551622dd..430a2b49 100644
--- a/src/scripts/coopstarter.js
+++ b/src/scripts/coopstarter.js
@@ -36,6 +36,18 @@ function refreshList(formId, listId) {
   });
 }
 
+//Remove pagination when there is no resource in a step group
+function actualizePagination() {
+  var resources_containers = document.querySelectorAll(
+    ".resource_by_step sib-form+div"
+  );
+  for (let resources_container of resources_containers) {
+    if (resources_container.innerHTML === "") {
+      resources_container.nextSibling.innerHTML = "";
+    }
+  }
+}
+
 jQuery(document).ready(function($) {
   // Get the element with id="defaultOpen" and click on it
   document.getElementById("defaultOpen").click();
@@ -76,6 +88,8 @@ jQuery(document).ready(function($) {
 
   forms.forEach(form => {
     form.addEventListener("populate", e => {
+      //On load in dashbord Entrepreneur
+      actualizePagination();
       //SEARCH BY KEYWORD
       //To retrieve keyword
       //https://git.happy-dev.fr/startinblox/framework/sib-core/issues/379
@@ -91,6 +105,7 @@ jQuery(document).ready(function($) {
       keyword_submit.addEventListener("click", function() {
         keyword_hidden_fields.forEach(hidden_field => {
           hidden_field.setAttribute("value", keyword_field.value);
+          actualizePagination();
           form.querySelector("sib-form").component.inputChange();
         });
       });
@@ -122,26 +137,24 @@ jQuery(document).ready(function($) {
           'hidden-widget[name="more_criterias_hidden"] select[name="format"]'
         );
 
-
-
         format_field_search.onchange = function() {
           console.log("format_field_search", format_field_search);
           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"
               );
 
               if (option_hidden.value == option_selected.value) {
-                console.log("option_selected", option_selected )
+                console.log("option_selected", option_selected);
                 option_hidden.setAttribute("checked", "checked");
-                console.log("option_hidden", option_hidden )
+                console.log("option_hidden", option_hidden);
               }
-              
             }
+            actualizePagination();
+            form.querySelector("sib-form").component.inputChange();
           });
         };
 
@@ -161,6 +174,7 @@ jQuery(document).ready(function($) {
               language_field_search.options[language_field_search.selectedIndex]
                 .text
             );
+            actualizePagination();
             form.querySelector("sib-form").component.inputChange();
           });
         };
@@ -178,6 +192,7 @@ jQuery(document).ready(function($) {
         year_field_search.addEventListener("input", function() {
           year_hidden_fields.forEach(year_field => {
             year_field.setAttribute("value", year_field_search.value);
+            actualizePagination();
             form.querySelector("sib-form").component.inputChange();
           });
         });
@@ -193,6 +208,7 @@ jQuery(document).ready(function($) {
         country_field_search.addEventListener("input", function() {
           country_hidden_fields.forEach(country_field => {
             country_field.setAttribute("value", country_field_search.value);
+            actualizePagination();
             form.querySelector("sib-form").component.inputChange();
           });
         });
-- 
GitLab


From 9bfae0eb24f63cea4025c1b80ec38adffbd46aa4 Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Mon, 16 Sep 2019 10:15:45 +0200
Subject: [PATCH 02/13] Feature: Filter resources by language.

---
 src/includes/entrepreneur/resources/list.pug | 92 +++++++++++++-------
 src/scripts/coopstarter.js                   | 38 +++++---
 2 files changed, 90 insertions(+), 40 deletions(-)

diff --git a/src/includes/entrepreneur/resources/list.pug b/src/includes/entrepreneur/resources/list.pug
index c289cc8a..ef0085d2 100644
--- a/src/includes/entrepreneur/resources/list.pug
+++ b/src/includes/entrepreneur/resources/list.pug
@@ -41,27 +41,27 @@ container.block_list.flex.flex_espace
 
         sib-form#more_criterias(
             data-src=`${endpoints.resources}`,
-            fields='header_criterias, format, publication_year, country, language.name, fields'
+            fields='header_criterias, format, publication_year, country, language, fields'
             
             label-header_criterias='More criterias'
             label-format='Format:'
             label-publication_year='Year of publication'
             label-country='Country of publication'
-            label-language.name='Language'
+            label-language='Language'
             label-fields='Field'
             widget-header_criterias='cs-section_header'
 
-            range-language.name=`${endpoints.languages}`
+            range-language=`${endpoints.languages}`
             range-fields=`${endpoints.fields}`
             range-format=`${endpoints.formats}`
 
-            multiple-language.name='sib-multiple-select'
-            widget-language.name='sib-form-auto-completion'
+            multiple-language='sib-form-dropdown'
+            widget-language='sib-form-auto-completion'
 
             multiple-format='sib-form-dropdown'
             widget-format='sib-form-auto-completion'
 
-            multiple-fields='sib-multiple-select'
+            multiple-fields='sib-form-dropdown'
             widget-fields='sib-form-auto-completion'
                             
             naked
@@ -91,24 +91,32 @@ container.block_list.flex.flex_espace
   
     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)',  
+        fields='name, author, format, publication_year, description,  country, language, field',
+        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
         search-range-format=`${endpoints.formats}`
+        search-range-language=`${endpoints.languages}`
+
 
         search-widget-search_for_a_resource="hidden-widget"
         search-widget-more_criterias_hidden="hidden-widget"
-        search-widget-format='sib-form-dropdown'
+        search-multiple-format='sib-form-dropdown'
+        search-widget-format='sib-form-auto-completion'
+        search-multiple-language='sib-form-dropdown'
+        search-widget-language='sib-form-auto-completion'
+
  
         widget-name='cs-display-property'
         widget-country='cs-display-property'
         widget-publication_year='cs-display-property'
         widget-description='cs-display-property'
         widget-field='cs-display-property'
-        widget-language.name="hidden-widget"
+        widget-language="hidden-widget"
         widget-author="cs-display-property"
         widget-format='cs-display-multiple-property'
         label-format=''
         multiple-format
+        label-language=''
+        multiple-language
         
         paginate-by="5"
     )
@@ -126,27 +134,33 @@ container.block_list.flex.flex_espace
 
     sib-display.resource_by_step(
         data-src=`${endpoints.steps}2/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, field',
+        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
         search-range-format=`${endpoints.formats}`
+        search-range-language=`${endpoints.languages}`
+
 
         search-widget-search_for_a_resource="hidden-widget"
         search-widget-more_criterias_hidden="hidden-widget"
         search-multiple-format='sib-form-dropdown'
         search-widget-format='sib-form-auto-completion'
+        search-multiple-language='sib-form-dropdown'
+        search-widget-language='sib-form-auto-completion'
 
+ 
         widget-name='cs-display-property'
         widget-country='cs-display-property'
         widget-publication_year='cs-display-property'
         widget-description='cs-display-property'
         widget-field='cs-display-property'
-        widget-language.name="hidden-widget"
+        widget-language="hidden-widget"
         widget-author="cs-display-property"
         widget-format='cs-display-multiple-property'
         label-format=''
         multiple-format
-
+        label-language=''
+        multiple-language
+        
         paginate-by="5"
     )
 
@@ -164,27 +178,33 @@ 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, field',
+        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
         search-range-format=`${endpoints.formats}`
+        search-range-language=`${endpoints.languages}`
+
 
         search-widget-search_for_a_resource="hidden-widget"
         search-widget-more_criterias_hidden="hidden-widget"
         search-multiple-format='sib-form-dropdown'
         search-widget-format='sib-form-auto-completion'
+        search-multiple-language='sib-form-dropdown'
+        search-widget-language='sib-form-auto-completion'
 
+ 
         widget-name='cs-display-property'
         widget-country='cs-display-property'
         widget-publication_year='cs-display-property'
         widget-description='cs-display-property'
         widget-field='cs-display-property'
-        widget-language.name="hidden-widget"
+        widget-language="hidden-widget"
         widget-author="cs-display-property"
         widget-format='cs-display-multiple-property'
         label-format=''
         multiple-format
-
+        label-language=''
+        multiple-language
+        
         paginate-by="5"
     )
 
@@ -202,27 +222,33 @@ container.block_list.flex.flex_espace
 
     sib-display.resource_by_step(
         data-src=`${endpoints.steps}4/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, field',
+        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
         search-range-format=`${endpoints.formats}`
+        search-range-language=`${endpoints.languages}`
+
 
         search-widget-search_for_a_resource="hidden-widget"
         search-widget-more_criterias_hidden="hidden-widget"
         search-multiple-format='sib-form-dropdown'
         search-widget-format='sib-form-auto-completion'
+        search-multiple-language='sib-form-dropdown'
+        search-widget-language='sib-form-auto-completion'
 
+ 
         widget-name='cs-display-property'
         widget-country='cs-display-property'
         widget-publication_year='cs-display-property'
         widget-description='cs-display-property'
         widget-field='cs-display-property'
-        widget-language.name="hidden-widget"
+        widget-language="hidden-widget"
         widget-author="cs-display-property"
         widget-format='cs-display-multiple-property'
         label-format=''
         multiple-format
-
+        label-language=''
+        multiple-language
+        
         paginate-by="5"
     )
 
@@ -239,27 +265,33 @@ container.block_list.flex.flex_espace
 
     sib-display.resource_by_step(
         data-src=`${endpoints.steps}5/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, field',
+        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
         search-range-format=`${endpoints.formats}`
+        search-range-language=`${endpoints.languages}`
+
 
         search-widget-search_for_a_resource="hidden-widget"
         search-widget-more_criterias_hidden="hidden-widget"
         search-multiple-format='sib-form-dropdown'
         search-widget-format='sib-form-auto-completion'
+        search-multiple-language='sib-form-dropdown'
+        search-widget-language='sib-form-auto-completion'
 
+ 
         widget-name='cs-display-property'
         widget-country='cs-display-property'
         widget-publication_year='cs-display-property'
         widget-description='cs-display-property'
         widget-field='cs-display-property'
-        widget-language.name="hidden-widget"
+        widget-language="hidden-widget"
         widget-author="cs-display-property"
         widget-format='cs-display-multiple-property'
         label-format=''
         multiple-format
-
+        label-language=''
+        multiple-language
+        
         paginate-by="5"
     )
     
diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js
index e298943a..accc0103 100644
--- a/src/scripts/coopstarter.js
+++ b/src/scripts/coopstarter.js
@@ -48,6 +48,11 @@ function actualizePagination() {
   }
 }
 
+//Manage select hidden to fullfill them with more "more criterias" selection
+function selectHiddenManagement() {
+  //Need to refactor the part
+}
+
 jQuery(document).ready(function($) {
   // Get the element with id="defaultOpen" and click on it
   document.getElementById("defaultOpen").click();
@@ -165,21 +170,34 @@ jQuery(document).ready(function($) {
         };
 
         //To retrieve language
-        //TODO: How we should filled the hidden field?
         let language_field_search = more_criterias_form.querySelector(
-          `select[name="language.name"]`
+          `select[name="language"]`
         );
-        language_hidden_fields = document.querySelectorAll(
-          'hidden-widget[name="more_criterias_hidden"] input[name="language.name"]'
+        language_hidden_field = document.querySelectorAll(
+          'hidden-widget[name="more_criterias_hidden"] select[name="language"]'
         );
 
         language_field_search.onchange = function() {
-          language_hidden_fields.forEach(language_field => {
-            language_field.setAttribute(
-              "value",
-              language_field_search.options[language_field_search.selectedIndex]
-                .text
-            );
+          let option_selected = language_field_search.querySelector(
+            "option:checked"
+          );
+          
+          language_hidden_field.forEach(function(select_hidden) {
+            options_hidden = select_hidden.getElementsByTagName("option");
+            for (let option_hidden of options_hidden) {
+              //Removing the selected attribute from previous selection
+              option_hidden.removeAttribute("selected");
+
+              if (option_hidden.value == option_selected.value) {
+                //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();
           });
-- 
GitLab


From 3840dacfcc6946497b5ecc601f7241580b58c151 Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Mon, 16 Sep 2019 11:23:30 +0200
Subject: [PATCH 03/13] WIP: Filter by Field.

---
 src/includes/entrepreneur/resources/list.pug | 39 +++++++++++++---
 src/scripts/coopstarter.js                   | 48 +++++++++++++++++++-
 2 files changed, 78 insertions(+), 9 deletions(-)

diff --git a/src/includes/entrepreneur/resources/list.pug b/src/includes/entrepreneur/resources/list.pug
index ef0085d2..b901bcde 100644
--- a/src/includes/entrepreneur/resources/list.pug
+++ b/src/includes/entrepreneur/resources/list.pug
@@ -41,18 +41,18 @@ container.block_list.flex.flex_espace
 
         sib-form#more_criterias(
             data-src=`${endpoints.resources}`,
-            fields='header_criterias, format, publication_year, country, language, fields'
+            fields='header_criterias, format, publication_year, country, language, field'
             
             label-header_criterias='More criterias'
             label-format='Format:'
             label-publication_year='Year of publication'
             label-country='Country of publication'
             label-language='Language'
-            label-fields='Field'
+            label-field='Field'
             widget-header_criterias='cs-section_header'
 
             range-language=`${endpoints.languages}`
-            range-fields=`${endpoints.fields}`
+            range-field=`${endpoints.fields}`
             range-format=`${endpoints.formats}`
 
             multiple-language='sib-form-dropdown'
@@ -61,8 +61,8 @@ container.block_list.flex.flex_espace
             multiple-format='sib-form-dropdown'
             widget-format='sib-form-auto-completion'
 
-            multiple-fields='sib-form-dropdown'
-            widget-fields='sib-form-auto-completion'
+            multiple-field='sib-form-dropdown'
+            widget-field='sib-form-auto-completion'
                             
             naked
         )
@@ -95,6 +95,7 @@ container.block_list.flex.flex_espace
         search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
         search-range-format=`${endpoints.formats}`
         search-range-language=`${endpoints.languages}`
+        search-range-field=`${endpoints.fields}`
 
 
         search-widget-search_for_a_resource="hidden-widget"
@@ -103,6 +104,8 @@ container.block_list.flex.flex_espace
         search-widget-format='sib-form-auto-completion'
         search-multiple-language='sib-form-dropdown'
         search-widget-language='sib-form-auto-completion'
+        search-multiple-field='sib-form-dropdown'
+        search-widget-field='sib-form-auto-completion'
 
  
         widget-name='cs-display-property'
@@ -117,6 +120,8 @@ container.block_list.flex.flex_espace
         multiple-format
         label-language=''
         multiple-language
+        label-field=''
+        multiple-field
         
         paginate-by="5"
     )
@@ -138,6 +143,7 @@ container.block_list.flex.flex_espace
         search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
         search-range-format=`${endpoints.formats}`
         search-range-language=`${endpoints.languages}`
+        search-range-field=`${endpoints.fields}`
 
 
         search-widget-search_for_a_resource="hidden-widget"
@@ -146,6 +152,8 @@ container.block_list.flex.flex_espace
         search-widget-format='sib-form-auto-completion'
         search-multiple-language='sib-form-dropdown'
         search-widget-language='sib-form-auto-completion'
+        search-multiple-field='sib-form-dropdown'
+        search-widget-field='sib-form-auto-completion'
 
  
         widget-name='cs-display-property'
@@ -160,6 +168,8 @@ container.block_list.flex.flex_espace
         multiple-format
         label-language=''
         multiple-language
+        label-field=''
+        multiple-field
         
         paginate-by="5"
     )
@@ -178,10 +188,11 @@ 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, field',
+        fields='name, author, format, publication_year, description,  country, language, field',
         search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
         search-range-format=`${endpoints.formats}`
         search-range-language=`${endpoints.languages}`
+        search-range-field=`${endpoints.fields}`
 
 
         search-widget-search_for_a_resource="hidden-widget"
@@ -190,6 +201,8 @@ container.block_list.flex.flex_espace
         search-widget-format='sib-form-auto-completion'
         search-multiple-language='sib-form-dropdown'
         search-widget-language='sib-form-auto-completion'
+        search-multiple-field='sib-form-dropdown'
+        search-widget-field='sib-form-auto-completion'
 
  
         widget-name='cs-display-property'
@@ -204,6 +217,8 @@ container.block_list.flex.flex_espace
         multiple-format
         label-language=''
         multiple-language
+        label-field=''
+        multiple-field
         
         paginate-by="5"
     )
@@ -226,14 +241,17 @@ container.block_list.flex.flex_espace
         search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
         search-range-format=`${endpoints.formats}`
         search-range-language=`${endpoints.languages}`
-
+        search-range-field=`${endpoints.fields}`
 
         search-widget-search_for_a_resource="hidden-widget"
         search-widget-more_criterias_hidden="hidden-widget"
+
         search-multiple-format='sib-form-dropdown'
         search-widget-format='sib-form-auto-completion'
         search-multiple-language='sib-form-dropdown'
         search-widget-language='sib-form-auto-completion'
+        search-multiple-field='sib-form-dropdown'
+        search-widget-field='sib-form-auto-completion'
 
  
         widget-name='cs-display-property'
@@ -248,6 +266,8 @@ container.block_list.flex.flex_espace
         multiple-format
         label-language=''
         multiple-language
+        label-field=''
+        multiple-field
         
         paginate-by="5"
     )
@@ -269,6 +289,7 @@ container.block_list.flex.flex_espace
         search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
         search-range-format=`${endpoints.formats}`
         search-range-language=`${endpoints.languages}`
+        search-range-field=`${endpoints.fields}`
 
 
         search-widget-search_for_a_resource="hidden-widget"
@@ -277,6 +298,8 @@ container.block_list.flex.flex_espace
         search-widget-format='sib-form-auto-completion'
         search-multiple-language='sib-form-dropdown'
         search-widget-language='sib-form-auto-completion'
+        search-multiple-field='sib-form-dropdown'
+        search-widget-field='sib-form-auto-completion'
 
  
         widget-name='cs-display-property'
@@ -291,6 +314,8 @@ container.block_list.flex.flex_espace
         multiple-format
         label-language=''
         multiple-language
+        label-field=''
+        multiple-field
         
         paginate-by="5"
     )
diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js
index accc0103..684630da 100644
--- a/src/scripts/coopstarter.js
+++ b/src/scripts/coopstarter.js
@@ -142,7 +142,6 @@ 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() {
           let option_selected = format_field_search.querySelector(
@@ -181,7 +180,7 @@ jQuery(document).ready(function($) {
           let option_selected = language_field_search.querySelector(
             "option:checked"
           );
-          
+
           language_hidden_field.forEach(function(select_hidden) {
             options_hidden = select_hidden.getElementsByTagName("option");
             for (let option_hidden of options_hidden) {
@@ -192,6 +191,7 @@ jQuery(document).ready(function($) {
                 //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
@@ -203,6 +203,50 @@ jQuery(document).ready(function($) {
           });
         };
 
+        //To retrieve field
+        let field_field_search = more_criterias_form.querySelector(
+          `select[name="field"]`
+        );
+        let field_hidden_field = document.querySelectorAll(
+          'hidden-widget[name="more_criterias_hidden"] select[name="field"]'
+        );
+        console.log("field_field_search", field_field_search)
+
+        console.log("field_hidden_field", field_hidden_field)
+
+
+        field_field_search.onchange = function() {
+          let option_selected = field_field_search.querySelector(
+            "option:checked"
+          );
+
+          field_hidden_field.forEach(function(select_hidden) {
+            options_hidden = select_hidden.getElementsByTagName("option");
+            for (let option_hidden of options_hidden) {
+              //Removing the selected attribute from previous selection
+              option_hidden.removeAttribute("selected");
+              console.log("option_hidden.value", option_hidden.value)
+              console.log("option_selected.value", option_selected.value)
+
+              if (option_hidden.value == option_selected.value) {
+                //Actually selecting the option if it is the good one
+                console.log("match")
+                option_hidden.setAttribute("selected", "selected");
+                select_hidden.setAttribute('value', option_selected.value)
+                console.log("select_hidden", select_hidden)
+
+              }
+
+              //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();
+          });
+        };
+
+
         //To retrieve year of publication
         //WARNING: If the user want to select "20" to get 21century made, he will get no result.
         //I think it is a UX problem.
-- 
GitLab


From 0fa6ceaf500f721c11a875d9a6604eb1b19fc13b Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Mon, 16 Sep 2019 12:25:30 +0200
Subject: [PATCH 04/13] Manage the pagination.

---
 src/scripts/coopstarter.js | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js
index 684630da..78e572b9 100644
--- a/src/scripts/coopstarter.js
+++ b/src/scripts/coopstarter.js
@@ -38,12 +38,16 @@ function refreshList(formId, listId) {
 
 //Remove pagination when there is no resource in a step group
 function actualizePagination() {
+  console.log("we actu")
   var resources_containers = document.querySelectorAll(
     ".resource_by_step sib-form+div"
   );
   for (let resources_container of resources_containers) {
-    if (resources_container.innerHTML === "") {
-      resources_container.nextSibling.innerHTML = "";
+    if (resources_container.childElementCount < 5 || resources_container.nextSibling.querySelector("nav span span+span").textContent == 1 ) {
+      resources_container.nextSibling.setAttribute("style", "display:none");
+    } else {
+      resources_container.nextSibling.setAttribute("style", "display:block");
+
     }
   }
 }
@@ -54,6 +58,8 @@ function selectHiddenManagement() {
 }
 
 jQuery(document).ready(function($) {
+  //Actualize pagination
+  actualizePagination()
   // Get the element with id="defaultOpen" and click on it
   document.getElementById("defaultOpen").click();
 
@@ -210,10 +216,6 @@ jQuery(document).ready(function($) {
         let field_hidden_field = document.querySelectorAll(
           'hidden-widget[name="more_criterias_hidden"] select[name="field"]'
         );
-        console.log("field_field_search", field_field_search)
-
-        console.log("field_hidden_field", field_hidden_field)
-
 
         field_field_search.onchange = function() {
           let option_selected = field_field_search.querySelector(
@@ -225,15 +227,15 @@ jQuery(document).ready(function($) {
             for (let option_hidden of options_hidden) {
               //Removing the selected attribute from previous selection
               option_hidden.removeAttribute("selected");
-              console.log("option_hidden.value", option_hidden.value)
-              console.log("option_selected.value", option_selected.value)
+
 
               if (option_hidden.value == option_selected.value) {
                 //Actually selecting the option if it is the good one
                 console.log("match")
                 option_hidden.setAttribute("selected", "selected");
                 select_hidden.setAttribute('value', option_selected.value)
-                console.log("select_hidden", select_hidden)
+                console.log("option_hidden.value", option_hidden.value)
+                console.log("option_selected.value", option_selected.value)
 
               }
 
-- 
GitLab


From 20f8a028e834d3cefd60be5f1bd77e341bff6b89 Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Mon, 16 Sep 2019 12:48:57 +0200
Subject: [PATCH 05/13] Feature: Filter by Fields.

---
 src/includes/entrepreneur/resources/list.pug | 92 ++++++++++----------
 src/scripts/coopstarter.js                   |  8 +-
 2 files changed, 48 insertions(+), 52 deletions(-)

diff --git a/src/includes/entrepreneur/resources/list.pug b/src/includes/entrepreneur/resources/list.pug
index b901bcde..6421aceb 100644
--- a/src/includes/entrepreneur/resources/list.pug
+++ b/src/includes/entrepreneur/resources/list.pug
@@ -41,18 +41,18 @@ container.block_list.flex.flex_espace
 
         sib-form#more_criterias(
             data-src=`${endpoints.resources}`,
-            fields='header_criterias, format, publication_year, country, language, field'
+            fields='header_criterias, format, publication_year, country, language, fields'
             
             label-header_criterias='More criterias'
             label-format='Format:'
             label-publication_year='Year of publication'
             label-country='Country of publication'
             label-language='Language'
-            label-field='Field'
+            label-fields='Field'
             widget-header_criterias='cs-section_header'
 
             range-language=`${endpoints.languages}`
-            range-field=`${endpoints.fields}`
+            range-fields=`${endpoints.fields}`
             range-format=`${endpoints.formats}`
 
             multiple-language='sib-form-dropdown'
@@ -61,8 +61,8 @@ container.block_list.flex.flex_espace
             multiple-format='sib-form-dropdown'
             widget-format='sib-form-auto-completion'
 
-            multiple-field='sib-form-dropdown'
-            widget-field='sib-form-auto-completion'
+            multiple-fields='sib-form-dropdown'
+            widget-fields='sib-form-auto-completion'
                             
             naked
         )
@@ -91,11 +91,11 @@ container.block_list.flex.flex_espace
   
     sib-display.resource_by_step(
         data-src=`${endpoints.steps}1/resources/`,
-        fields='name, author, format, publication_year, description,  country, language, field',
-        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
+        fields='name, author, format, publication_year, description,  country, language, fields',
+        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, fields)',  
         search-range-format=`${endpoints.formats}`
         search-range-language=`${endpoints.languages}`
-        search-range-field=`${endpoints.fields}`
+        search-range-fields=`${endpoints.fields}`
 
 
         search-widget-search_for_a_resource="hidden-widget"
@@ -104,15 +104,15 @@ container.block_list.flex.flex_espace
         search-widget-format='sib-form-auto-completion'
         search-multiple-language='sib-form-dropdown'
         search-widget-language='sib-form-auto-completion'
-        search-multiple-field='sib-form-dropdown'
-        search-widget-field='sib-form-auto-completion'
+        search-multiple-fields='sib-form-dropdown'
+        search-widget-fields='sib-form-auto-completion'
 
  
         widget-name='cs-display-property'
         widget-country='cs-display-property'
         widget-publication_year='cs-display-property'
         widget-description='cs-display-property'
-        widget-field='cs-display-property'
+        widget-fields='hidden-widget'
         widget-language="hidden-widget"
         widget-author="cs-display-property"
         widget-format='cs-display-multiple-property'
@@ -120,8 +120,8 @@ container.block_list.flex.flex_espace
         multiple-format
         label-language=''
         multiple-language
-        label-field=''
-        multiple-field
+        label-fields=''
+        multiple-fields
         
         paginate-by="5"
     )
@@ -139,11 +139,11 @@ container.block_list.flex.flex_espace
 
     sib-display.resource_by_step(
         data-src=`${endpoints.steps}2/resources/`,
-        fields='name, author, format, publication_year, description,  country, language, field',
-        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
+        fields='name, author, format, publication_year, description,  country, language, fields',
+        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, fields)',  
         search-range-format=`${endpoints.formats}`
         search-range-language=`${endpoints.languages}`
-        search-range-field=`${endpoints.fields}`
+        search-range-fields=`${endpoints.fields}`
 
 
         search-widget-search_for_a_resource="hidden-widget"
@@ -152,15 +152,15 @@ container.block_list.flex.flex_espace
         search-widget-format='sib-form-auto-completion'
         search-multiple-language='sib-form-dropdown'
         search-widget-language='sib-form-auto-completion'
-        search-multiple-field='sib-form-dropdown'
-        search-widget-field='sib-form-auto-completion'
+        search-multiple-fields='sib-form-dropdown'
+        search-widget-fields='sib-form-auto-completion'
 
  
         widget-name='cs-display-property'
         widget-country='cs-display-property'
         widget-publication_year='cs-display-property'
         widget-description='cs-display-property'
-        widget-field='cs-display-property'
+        widget-fields='hidden-widget'
         widget-language="hidden-widget"
         widget-author="cs-display-property"
         widget-format='cs-display-multiple-property'
@@ -168,8 +168,8 @@ container.block_list.flex.flex_espace
         multiple-format
         label-language=''
         multiple-language
-        label-field=''
-        multiple-field
+        label-fields=''
+        multiple-fields
         
         paginate-by="5"
     )
@@ -188,11 +188,11 @@ 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, field',
-        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
+        fields='name, author, format, publication_year, description,  country, language, fields',
+        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, fields)',  
         search-range-format=`${endpoints.formats}`
         search-range-language=`${endpoints.languages}`
-        search-range-field=`${endpoints.fields}`
+        search-range-fields=`${endpoints.fields}`
 
 
         search-widget-search_for_a_resource="hidden-widget"
@@ -201,15 +201,15 @@ container.block_list.flex.flex_espace
         search-widget-format='sib-form-auto-completion'
         search-multiple-language='sib-form-dropdown'
         search-widget-language='sib-form-auto-completion'
-        search-multiple-field='sib-form-dropdown'
-        search-widget-field='sib-form-auto-completion'
+        search-multiple-fields='sib-form-dropdown'
+        search-widget-fields='sib-form-auto-completion'
 
  
         widget-name='cs-display-property'
         widget-country='cs-display-property'
         widget-publication_year='cs-display-property'
         widget-description='cs-display-property'
-        widget-field='cs-display-property'
+        widget-fields='hidden-widget'
         widget-language="hidden-widget"
         widget-author="cs-display-property"
         widget-format='cs-display-multiple-property'
@@ -217,8 +217,8 @@ container.block_list.flex.flex_espace
         multiple-format
         label-language=''
         multiple-language
-        label-field=''
-        multiple-field
+        label-fields=''
+        multiple-fields
         
         paginate-by="5"
     )
@@ -237,28 +237,28 @@ container.block_list.flex.flex_espace
 
     sib-display.resource_by_step(
         data-src=`${endpoints.steps}4/resources/`,
-       fields='name, author, format, publication_year, description,  country, language, field',
-        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
+        fields='name, author, format, publication_year, description,  country, language, fields',
+        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, fields)',  
         search-range-format=`${endpoints.formats}`
         search-range-language=`${endpoints.languages}`
-        search-range-field=`${endpoints.fields}`
+        search-range-fields=`${endpoints.fields}`
+
 
         search-widget-search_for_a_resource="hidden-widget"
         search-widget-more_criterias_hidden="hidden-widget"
-
         search-multiple-format='sib-form-dropdown'
         search-widget-format='sib-form-auto-completion'
         search-multiple-language='sib-form-dropdown'
         search-widget-language='sib-form-auto-completion'
-        search-multiple-field='sib-form-dropdown'
-        search-widget-field='sib-form-auto-completion'
+        search-multiple-fields='sib-form-dropdown'
+        search-widget-fields='sib-form-auto-completion'
 
  
         widget-name='cs-display-property'
         widget-country='cs-display-property'
         widget-publication_year='cs-display-property'
         widget-description='cs-display-property'
-        widget-field='cs-display-property'
+        widget-fields='hidden-widget'
         widget-language="hidden-widget"
         widget-author="cs-display-property"
         widget-format='cs-display-multiple-property'
@@ -266,8 +266,8 @@ container.block_list.flex.flex_espace
         multiple-format
         label-language=''
         multiple-language
-        label-field=''
-        multiple-field
+        label-fields=''
+        multiple-fields
         
         paginate-by="5"
     )
@@ -285,11 +285,11 @@ container.block_list.flex.flex_espace
 
     sib-display.resource_by_step(
         data-src=`${endpoints.steps}5/resources/`,
-        fields='name, author, format, publication_year, description,  country, language, field',
-        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, field)',  
+        fields='name, author, format, publication_year, description,  country, language, fields',
+        search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language, fields)',  
         search-range-format=`${endpoints.formats}`
         search-range-language=`${endpoints.languages}`
-        search-range-field=`${endpoints.fields}`
+        search-range-fields=`${endpoints.fields}`
 
 
         search-widget-search_for_a_resource="hidden-widget"
@@ -298,15 +298,15 @@ container.block_list.flex.flex_espace
         search-widget-format='sib-form-auto-completion'
         search-multiple-language='sib-form-dropdown'
         search-widget-language='sib-form-auto-completion'
-        search-multiple-field='sib-form-dropdown'
-        search-widget-field='sib-form-auto-completion'
+        search-multiple-fields='sib-form-dropdown'
+        search-widget-fields='sib-form-auto-completion'
 
  
         widget-name='cs-display-property'
         widget-country='cs-display-property'
         widget-publication_year='cs-display-property'
         widget-description='cs-display-property'
-        widget-field='cs-display-property'
+        widget-fields='hidden-widget'
         widget-language="hidden-widget"
         widget-author="cs-display-property"
         widget-format='cs-display-multiple-property'
@@ -314,8 +314,8 @@ container.block_list.flex.flex_espace
         multiple-format
         label-language=''
         multiple-language
-        label-field=''
-        multiple-field
+        label-fields=''
+        multiple-fields
         
         paginate-by="5"
     )
diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js
index 78e572b9..76f69067 100644
--- a/src/scripts/coopstarter.js
+++ b/src/scripts/coopstarter.js
@@ -211,10 +211,10 @@ jQuery(document).ready(function($) {
 
         //To retrieve field
         let field_field_search = more_criterias_form.querySelector(
-          `select[name="field"]`
+          `select[name="fields"]`
         );
         let field_hidden_field = document.querySelectorAll(
-          'hidden-widget[name="more_criterias_hidden"] select[name="field"]'
+          'hidden-widget[name="more_criterias_hidden"] select[name="fields"]'
         );
 
         field_field_search.onchange = function() {
@@ -231,12 +231,8 @@ jQuery(document).ready(function($) {
 
               if (option_hidden.value == option_selected.value) {
                 //Actually selecting the option if it is the good one
-                console.log("match")
                 option_hidden.setAttribute("selected", "selected");
                 select_hidden.setAttribute('value', option_selected.value)
-                console.log("option_hidden.value", option_hidden.value)
-                console.log("option_selected.value", option_selected.value)
-
               }
 
               //Trigerring a reload of the associated form
-- 
GitLab


From 496a105f6cf674ff137ab67b25fea28670490c33 Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Mon, 16 Sep 2019 13:20:22 +0200
Subject: [PATCH 06/13] Feature: Refreshement after profile edition.

---
 src/includes/entrepreneur/profile/edit.pug | 6 ++++--
 src/includes/mentor/profile/edit.pug       | 6 ++++--
 src/scripts/coopstarter.js                 | 5 +++++
 3 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/src/includes/entrepreneur/profile/edit.pug b/src/includes/entrepreneur/profile/edit.pug
index 843aff7c..fc5da4bc 100644
--- a/src/includes/entrepreneur/profile/edit.pug
+++ b/src/includes/entrepreneur/profile/edit.pug
@@ -2,7 +2,7 @@ include ../../components/widgets
 
 h2.title_create Edit your account
 
-sib-form.block_log.block_creat_count(
+sib-form#entrepreneur_profile_edition.block_log.block_creat_count(
     bind-user
     fields="info(last_name, first_name, username, email, entrepreneur_profile.organisation)"     
     range-entrepreneur_profile.organisation=`${endpoints.organisations}`
@@ -25,4 +25,6 @@ sib-form.block_log.block_creat_count(
 
     submit-button="Save modifications"
     next='entrepreneur-resource-list'
-)
\ No newline at end of file
+)
+
+sib-link(class="backlink", next="entrepreneur-resource-list") Back to the dashboard
\ No newline at end of file
diff --git a/src/includes/mentor/profile/edit.pug b/src/includes/mentor/profile/edit.pug
index 773da3ff..1cdcc94f 100644
--- a/src/includes/mentor/profile/edit.pug
+++ b/src/includes/mentor/profile/edit.pug
@@ -2,7 +2,7 @@ include ../../components/widgets
 
 h2.title_create Edit your account
 
-sib-form.block_log.block_creat_count(
+sib-form#mentor_profile_edition.block_log.block_creat_count(
     bind-user
     fields="account_information(last_name, first_name, mentor_profile.organisation,\
             mentor_profile.phone, mentor_profile.languages, mentor_profile.fields),\
@@ -59,4 +59,6 @@ sib-form.block_log.block_creat_count(
 
     submit-button="Save modifications"
     next='mentor-dashboard'
-)
\ No newline at end of file
+)
+
+sib-link(class="backlink", next="mentor-resource-list") Back to the dashboard
\ No newline at end of file
diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js
index 76f69067..cccba750 100644
--- a/src/scripts/coopstarter.js
+++ b/src/scripts/coopstarter.js
@@ -77,6 +77,11 @@ jQuery(document).ready(function($) {
   refreshList("mentor_profile_creation", "mentor_info");
   refreshList("mentor_profile_creation", "mentor_complementary");
   refreshList("mentor_profile_creation", "mentor_contact");
+  refreshList("entrepreneur_profile_edition", "entrepreneur_info");
+  refreshList("entrepreneur_profile_edition", "entrepreneur_contact");
+  refreshList("mentor_profile_edition", "mentor_info");
+  refreshList("mentor_profile_edition", "mentor_complementary");
+  refreshList("mentor_profile_edition", "mentor_contact");
 
   const logoutButtons = document.getElementsByClassName("logout-button");
   for (var i = 0; i < logoutButtons.length; i++) {
-- 
GitLab


From f863d5cdcbbd5235a55c4fc0dfce8da97fb2b4bf Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Mon, 16 Sep 2019 15:54:10 +0200
Subject: [PATCH 07/13] First test on loader in entrepreneur dashboard.

---
 src/includes/entrepreneur/dashboard.pug      |  2 ++
 src/includes/entrepreneur/resources/list.pug | 11 ++++++-----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/src/includes/entrepreneur/dashboard.pug b/src/includes/entrepreneur/dashboard.pug
index 422ad21f..e91bebd0 100644
--- a/src/includes/entrepreneur/dashboard.pug
+++ b/src/includes/entrepreneur/dashboard.pug
@@ -7,6 +7,8 @@ header#header(role='banner')
     include ./components/header.pug
 
 section#home
+    div#coopstarter-loader
+        hidden Loading, please wait...
 
     //TODO:
     //-Distinguish the search form from the listing
diff --git a/src/includes/entrepreneur/resources/list.pug b/src/includes/entrepreneur/resources/list.pug
index 6421aceb..124b14c5 100644
--- a/src/includes/entrepreneur/resources/list.pug
+++ b/src/includes/entrepreneur/resources/list.pug
@@ -16,6 +16,7 @@ container.block_list.flex.flex_espace
             h2.title_form Search for a resource
             sib-form#search-by-keyword(
                 data-src=`${endpoints.resources}`,
+                loader-id="coopstarter-loader"
                 fields='keyword(name_keyword, description, author)'    
                 label-keyword="Search by author, name..."
                 widget-keyword="sib-form-placeholder-text"
@@ -29,7 +30,7 @@ container.block_list.flex.flex_espace
 
             div#keyword_submit.button__actions
                 div.button_base.ico_gauche Search
-
+            
             sib-form#instance_database_only(
                 data-src=`${endpoints.resources}`,
                 fields='instance_database_only'    
@@ -38,11 +39,9 @@ container.block_list.flex.flex_espace
                 
                 naked
             )
-
         sib-form#more_criterias(
             data-src=`${endpoints.resources}`,
             fields='header_criterias, format, publication_year, country, language, fields'
-            
             label-header_criterias='More criterias'
             label-format='Format:'
             label-publication_year='Year of publication'
@@ -76,9 +75,12 @@ container.block_list.flex.flex_espace
                     div
                     div.button_base Make a request
 
+    div#resources-loader
+        hidden Loading resources, please wait...
 
     //Step 1
     sib-display#circles-list(
+        loader-id="resources-loader"
         data-src=`${endpoints.steps}1/`,
         fields='name'
 
@@ -87,8 +89,7 @@ container.block_list.flex.flex_espace
         
         widget-name='cs-steps-header'
     )
-
-  
+    
     sib-display.resource_by_step(
         data-src=`${endpoints.steps}1/resources/`,
         fields='name, author, format, publication_year, description,  country, language, fields',
-- 
GitLab


From 925603ad2b76339eb608b84c9589561f2fe80964 Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Mon, 16 Sep 2019 17:00:02 +0200
Subject: [PATCH 08/13] WIP: Search form for history of mentor resources.

---
 src/includes/mentor/resources/list.pug | 31 ++++++++++++++++++++++++--
 src/styles/index.scss                  |  2 +-
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/src/includes/mentor/resources/list.pug b/src/includes/mentor/resources/list.pug
index 8fcfea89..bde4d407 100644
--- a/src/includes/mentor/resources/list.pug
+++ b/src/includes/mentor/resources/list.pug
@@ -65,12 +65,39 @@ div.block_list
                     bind-user
                     nested-field='resources'
 
-                    fields='content(name, format, publication_year), actions(review.status, detail, edit, delete)',
+                    fields='search_for_a_resource(name, description, author),content(name, format, publication_year), actions(review.status, detail, edit, delete)',
+                    search-fields='search_for_a_resource, header_criterias, more_criterias_hidden(format, publication_year, country, language, fields)',  
+                    search-range-format=`${endpoints.formats}`
+                    search-range-language=`${endpoints.languages}`
+                    search-range-fields=`${endpoints.fields}`
+
+                    search-label-search_for_a_resource="Search by author, name..."
+                    search-widget-search_for_a_resource="sib-form-placeholder-text"
+                    widget-search_for_a_resource="hidden-widget"
+
+    
+                    search-multiple-format='sib-form-dropdown'
+                    search-widget-format='sib-form-auto-completion'
+                    search-multiple-language='sib-form-dropdown'
+                    search-widget-language='sib-form-auto-completion'
+                    search-multiple-fields='sib-form-dropdown'
+                    search-widget-fields='sib-form-auto-completion'
+
                     widget-review.status='cs-resource-status',
+                    search-widget-header_criterias="cs-section_header"
+                    search-label-header_criterias="More criterias"
+
+                    search-label-format='Format'
+                    search-label-publication_year='Year of publication'
+                    search-label-country='Country of publication'
+                    search-label-language='Language'
+                    search-label-fields='Field'
 
                     class-name="tit_element_list"
+         
+
                     widget-format='cs-display-multiple-property'
-                    label-format='Formats:'
+                    label-format='Formats'
                     class-format="contenu_list"
 
                     each-label-format=''
diff --git a/src/styles/index.scss b/src/styles/index.scss
index 93df0a0a..4681eb3a 100644
--- a/src/styles/index.scss
+++ b/src/styles/index.scss
@@ -399,7 +399,7 @@ ico_droite:before{
     display: block;
 }
 
-sib-form-label-text, sib-multiple-select,cs-form-password{
+sib-form-label-text, sib-form-dropdown, sib-multiple-select,cs-form-password{
 	display: block;
 	width: 48.5%;
 }
-- 
GitLab


From 5c67c6725d46ac809dee3ca3acf7f75ebfa21185 Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Mon, 16 Sep 2019 17:08:32 +0200
Subject: [PATCH 09/13] Feature: Search form for history of mentor resources.

---
 src/includes/mentor/resources/create.pug | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/includes/mentor/resources/create.pug b/src/includes/mentor/resources/create.pug
index 7ba9d9b1..6c273aca 100644
--- a/src/includes/mentor/resources/create.pug
+++ b/src/includes/mentor/resources/create.pug
@@ -8,7 +8,7 @@ p.p_entete Thank you for enriching our database !
     sib-form#resource-creation-form(
         data-src=`${endpoints.resources}`
         fields="mandatory_information(header_mandatory, name, country, language, uri,\
-                format, field, author, publication_year, skills),\
+                format, fields, author, publication_year, skills),\
                 complementary_information(header_complementary, description, iframe_link,\
                 preview_image, tags),classification(header_classification, target, type, steps),\
                 access(header_access, sharing),related_section(header_related, related)"
@@ -23,7 +23,7 @@ p.p_entete Thank you for enriching our database !
         range-format=`${endpoints.formats}`
         range-steps=`${endpoints.steps}`
         range-language=`${endpoints.languages}`
-        range-field=`${endpoints.fields}`
+        range-fields=`${endpoints.fields}`
         range-related=`${endpoints.resources}`
 
         label-header_mandatory='Mandatory information'
@@ -37,7 +37,7 @@ p.p_entete Thank you for enriching our database !
         label-language='Language*'
         label-uri='Location/weblink*'
         label-format='Format*'
-        label-field='Field*'
+        label-fields='Field*'
         label-author='Resource author*'
         label-publication_year='Year of publication*'
         label-skills='Learning outcomes, skills*'
@@ -54,8 +54,8 @@ p.p_entete Thank you for enriching our database !
 
         label-related='Add a resource'
         
-        multiple-field='sib-multiple-select'
-        widget-field='sib-form-auto-completion'
+        multiple-fields='sib-multiple-select'
+        widget-fields='sib-form-auto-completion'
 
         multiple-type='sib-multiple-select'
         widget-type='sib-form-auto-completion'
-- 
GitLab


From ec7c7c7c1914999f7b403da5d327185588490013 Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Mon, 16 Sep 2019 19:09:36 +0200
Subject: [PATCH 10/13] Feature: Add the validation process dialog.

---
 src/includes/mentor/dashboard.pug              |  7 +++++++
 src/includes/mentor/resources/confirmation.pug | 12 +++++++++++-
 src/includes/mentor/resources/list.pug         |  1 +
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/includes/mentor/dashboard.pug b/src/includes/mentor/dashboard.pug
index fc8f613b..0b8f5e82 100644
--- a/src/includes/mentor/dashboard.pug
+++ b/src/includes/mentor/dashboard.pug
@@ -18,6 +18,7 @@ section#home
             sib-ac-checker(permission="acl:Write" bind-resources)
                 sib-route(id-prefix=`${endpoints.resources}`, name='mentor-resource-detail', use-id)
                 sib-route(id-prefix=`${endpoints.resources}`, name='mentor-resource-validate', use-id)
+                sib-route(name='resource-validation-process')
 
         dialog#mentor-resource-detail.no-sidebar
             include resources/detail.pug
@@ -27,6 +28,10 @@ section#home
             include resources/validate.pug
             sib-link(class="backlink", next="mentor-resource-list") Back to the dashboard   
 
+        dialog#resource-validation-process
+            h1 What is a validation process ?
+            sib-link(class="backlink pull-right", next="mentor-resource-list") X
+
     #mentor-resource-create(hidden).no-sidebar.container
         sib-link(class="backlink", next="mentor-resource-list") Back to the dashboard
         include resources/create.pug
@@ -47,5 +52,7 @@ section#home
 
     #mentor-account-edit(hidden).no-sidebar.container
         include profile/edit.pug
+
+    
     
   
diff --git a/src/includes/mentor/resources/confirmation.pug b/src/includes/mentor/resources/confirmation.pug
index 2e2bd1aa..a47d8aaa 100644
--- a/src/includes/mentor/resources/confirmation.pug
+++ b/src/includes/mentor/resources/confirmation.pug
@@ -10,7 +10,17 @@ div.block_list
 
   div
     p.flex
-      sib-link(next="resource-validation-process") What is the validation process ?
+
+      sib-router
+        sib-route(name='resource-validation-process_confirmation')
+        
+      dialog#resource-validation-process_confirmation
+        h1 What is a validation process ?
+        sib-link(class="backlink pull-right", next="resource-creation-confirmation") X
+
+      sib-link(class="backlink", next="resource-validation-process_confirmation") What is a validation process ?
+       
+      
 
     div.flex
       h3.button_base
diff --git a/src/includes/mentor/resources/list.pug b/src/includes/mentor/resources/list.pug
index bde4d407..1e74ae68 100644
--- a/src/includes/mentor/resources/list.pug
+++ b/src/includes/mentor/resources/list.pug
@@ -25,6 +25,7 @@ div.block_list
         
         div.block_log.block_list
             div#reviews.tabcontent
+                sib-link(class="backlink pull-right", next="resource-validation-process") What is a validation process ?
                 sib-display#pending-resources(
                     data-src=`${endpoints.resources}pending/`
                     fields='content(name, info(author, publication_year)), validate',
-- 
GitLab


From 771fb2d431e7d05ac9fd654f49378eb1f045b542 Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Tue, 17 Sep 2019 15:24:10 +0200
Subject: [PATCH 11/13] Feature: Mentors are able to delete resources they've
 made.

---
 src/includes/components/widgets.pug           |  2 +-
 .../mentor/resources/confirmation.pug         |  4 +-
 src/includes/mentor/resources/detail.pug      | 13 ++++
 src/includes/mentor/resources/list.pug        | 23 ++++++
 src/scripts/coopstarter.js                    | 75 +++++++++++++++----
 5 files changed, 100 insertions(+), 17 deletions(-)

diff --git a/src/includes/components/widgets.pug b/src/includes/components/widgets.pug
index e605891a..dd460b9d 100644
--- a/src/includes/components/widgets.pug
+++ b/src/includes/components/widgets.pug
@@ -98,7 +98,7 @@ sib-widget(name='cs-delete-action')
     div
       sib-link(
         data-src="\${src}"
-        next="\${value}"
+        next="confirm_suppress"
       ) <i class="fas fa-trash-alt"></i>
 
 sib-widget(name='cs-broken-action')
diff --git a/src/includes/mentor/resources/confirmation.pug b/src/includes/mentor/resources/confirmation.pug
index a47d8aaa..964d2811 100644
--- a/src/includes/mentor/resources/confirmation.pug
+++ b/src/includes/mentor/resources/confirmation.pug
@@ -18,9 +18,7 @@ div.block_list
         h1 What is a validation process ?
         sib-link(class="backlink pull-right", next="resource-creation-confirmation") X
 
-      sib-link(class="backlink", next="resource-validation-process_confirmation") What is a validation process ?
-       
-      
+      sib-link(class="backlink pull-right", next="resource-validation-process_confirmation") What is a validation process ?  
 
     div.flex
       h3.button_base
diff --git a/src/includes/mentor/resources/detail.pug b/src/includes/mentor/resources/detail.pug
index 427645b0..5a63d5df 100644
--- a/src/includes/mentor/resources/detail.pug
+++ b/src/includes/mentor/resources/detail.pug
@@ -1,5 +1,13 @@
 include ../../components/widgets
 
+sib-router
+    sib-route( name='confirm_suppress', use-id)
+
+dialog#confirm_suppress
+    h1 confirm_suppress
+    sib-delete(data-label="Die bitch, die !!" bind-resources) 
+    sib-link(class="backlink pull-right", next="mentor-resource-list") X
+
 .block_log.block_creat_count.no_shadow
   sib-display(
     bind-resources,
@@ -114,5 +122,10 @@ include ../../components/widgets
     action-detail='mentor-resource-detail'
   )
 
+  sib-link(
+    bind-resources,
+      next="confirm_suppress"
+    ) <i class="fas fa-trash-alt"></i>
+
 
   
\ No newline at end of file
diff --git a/src/includes/mentor/resources/list.pug b/src/includes/mentor/resources/list.pug
index 1e74ae68..f5bcf2f2 100644
--- a/src/includes/mentor/resources/list.pug
+++ b/src/includes/mentor/resources/list.pug
@@ -1,5 +1,14 @@
 include ../../components/widgets
 
+sib-router
+    sib-route( name='confirm_suppress', use-id)
+
+dialog#confirm_suppress
+    h1 confirm_suppress
+    sib-delete(data-label="Die bitch, die !!" bind-resources) 
+    sib-link(class="backlink pull-right", next="mentor-resource-list") X
+
+
 div.container_min
     h2.title_lead.fd_bleu International index of resources for cooperative mentors and entrepreneurs
     button.button_dark.pull-right Watch the presentation
@@ -24,9 +33,13 @@ div.block_list
             h2 History of your resources
         
         div.block_log.block_list
+            
             div#reviews.tabcontent
+                div#loader-review-mentor
+                    hidden Loading, please wait...
                 sib-link(class="backlink pull-right", next="resource-validation-process") What is a validation process ?
                 sib-display#pending-resources(
+                    loader-id="loader-review-mentor"
                     data-src=`${endpoints.resources}pending/`
                     fields='content(name, info(author, publication_year)), validate',
 
@@ -42,8 +55,12 @@ div.block_list
                     widget-validate='cs-validate-action'
                 )
 
+            
             div(id='requests', class="tabcontent")
+                div#loader-requests-mentor
+                    hidden Loading, please wait...
                 sib-display.request_accordeon(
+                    loader-id="loader-requests-mentor"
                     data-src=`${endpoints.requests}`
                     fields='content(name, description), info(fields, language.name, target), create',
 
@@ -61,8 +78,12 @@ div.block_list
                     widget-create='cs-validate-action'
                 )
 
+            
             div(id='history', class="tabcontent")
+                div#loader-history-mentor
+                    hidden Loading, please wait...
                 sib-display#resources-history(
+                    loader-id="loader-history-mentor"
                     bind-user
                     nested-field='resources'
 
@@ -121,3 +142,5 @@ div.block_list
                     widget-delete='cs-delete-action'
                     action-delete='delete'
                 )
+
+
diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js
index cccba750..f7ae8029 100644
--- a/src/scripts/coopstarter.js
+++ b/src/scripts/coopstarter.js
@@ -28,6 +28,7 @@ function linkDatasetToField(detail, targetFormName, inputName) {
   });
 }
 
+//Refresh information after a form submission
 function refreshList(formId, listId) {
   let form = document.getElementById(formId);
   form.addEventListener("save", event => {
@@ -36,18 +37,44 @@ function refreshList(formId, listId) {
   });
 }
 
+// //Refresh information after a deletion
+// function refreshAfterDeletion() {
+//   let list = document.getElementById("resources-history");
+//   console.log("list", list);
+
+//   let element = document.querySelectorAll("sib-delete");
+//   console.log("element", element);
+
+//   element.addEventListener("resourceDeleted", e => {
+//     console.log("Resource deleted: ", e.detail.resource);
+//     list.dataset.src = list.dataset.src;
+//   });
+
+// let form = document.querySelectorAll("button");
+// console.log("form", form);
+// form.addEventListener("click", event => {
+
+//   let list = document.getElementById("resources-history");
+//   console.log("delete");
+
+//   list.dataset.src = list.dataset.src;
+// });
+// }
+
 //Remove pagination when there is no resource in a step group
 function actualizePagination() {
-  console.log("we actu")
   var resources_containers = document.querySelectorAll(
     ".resource_by_step sib-form+div"
   );
   for (let resources_container of resources_containers) {
-    if (resources_container.childElementCount < 5 || resources_container.nextSibling.querySelector("nav span span+span").textContent == 1 ) {
+    if (
+      resources_container.childElementCount < 5 ||
+      resources_container.nextSibling.querySelector("nav span span+span")
+        .textContent == 1
+    ) {
       resources_container.nextSibling.setAttribute("style", "display:none");
     } else {
       resources_container.nextSibling.setAttribute("style", "display:block");
-
     }
   }
 }
@@ -59,7 +86,8 @@ function selectHiddenManagement() {
 
 jQuery(document).ready(function($) {
   //Actualize pagination
-  actualizePagination()
+  actualizePagination();
+
   // Get the element with id="defaultOpen" and click on it
   document.getElementById("defaultOpen").click();
 
@@ -143,6 +171,30 @@ jQuery(document).ready(function($) {
 
       // https://git.happy-dev.fr/startinblox/framework/sib-core/issues/453
       window.setTimeout(() => {
+
+        //Refresh data list on delete resources
+        const deleteButton = document.querySelectorAll("sib-delete");
+
+        for (var i = 0; i < deleteButton.length; i++) {
+          deleteButton[i].addEventListener("resourceDeleted", e => {
+            const historyList = document.getElementById("resources-history");
+            historyList.dataset.src = historyList.dataset.src;
+
+            let confirm_suppress = document.getElementById("confirm_suppress");
+            confirm_suppress.setAttribute("hidden", "hidden");
+
+            //If we supress from the detail resource view, we close this view.
+            let mentor_resource_detail = document.getElementById("mentor-resource-detail");
+            mentor_resource_detail.setAttribute("hidden", "hidden");
+            this.dispatchEvent(
+              new CustomEvent("requestNavigation", {
+                bubbles: true,
+                detail: { route: "actions" }
+              })
+            );
+          });
+        }
+
         //To retrieve format
         //TODO: How we should filled the hidden field with multiple value?
         //TODO: The hidden search field set with one value doesn't work
@@ -167,11 +219,11 @@ jQuery(document).ready(function($) {
               if (option_hidden.value == option_selected.value) {
                 //Actually selecting the option if it is the good one
                 option_hidden.setAttribute("selected", "selected");
-                select_hidden.setAttribute('value', option_selected.value)
+                select_hidden.setAttribute("value", option_selected.value);
               }
 
               //Trigerring a reload of the associated form
-              let parent_form = select_hidden.closest('sib-form');
+              let parent_form = select_hidden.closest("sib-form");
               parent_form.component.inputChange();
             }
             actualizePagination();
@@ -201,12 +253,11 @@ jQuery(document).ready(function($) {
               if (option_hidden.value == option_selected.value) {
                 //Actually selecting the option if it is the good one
                 option_hidden.setAttribute("selected", "selected");
-                select_hidden.setAttribute('value', option_selected.value)
-
+                select_hidden.setAttribute("value", option_selected.value);
               }
 
               //Trigerring a reload of the associated form
-              let parent_form = select_hidden.closest('sib-form');
+              let parent_form = select_hidden.closest("sib-form");
               parent_form.component.inputChange();
             }
             actualizePagination();
@@ -233,15 +284,14 @@ jQuery(document).ready(function($) {
               //Removing the selected attribute from previous selection
               option_hidden.removeAttribute("selected");
 
-
               if (option_hidden.value == option_selected.value) {
                 //Actually selecting the option if it is the good one
                 option_hidden.setAttribute("selected", "selected");
-                select_hidden.setAttribute('value', option_selected.value)
+                select_hidden.setAttribute("value", option_selected.value);
               }
 
               //Trigerring a reload of the associated form
-              let parent_form = select_hidden.closest('sib-form');
+              let parent_form = select_hidden.closest("sib-form");
               parent_form.component.inputChange();
             }
             actualizePagination();
@@ -249,7 +299,6 @@ jQuery(document).ready(function($) {
           });
         };
 
-
         //To retrieve year of publication
         //WARNING: If the user want to select "20" to get 21century made, he will get no result.
         //I think it is a UX problem.
-- 
GitLab


From 2faa23a3576f14fc9757639fda8bde5b4fcc22f4 Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Tue, 17 Sep 2019 18:05:13 +0200
Subject: [PATCH 12/13] Patch after review.

---
 src/includes/mentor/resources/detail.pug |   2 +-
 src/scripts/coopstarter.js               | 131 +++++++----------------
 2 files changed, 41 insertions(+), 92 deletions(-)

diff --git a/src/includes/mentor/resources/detail.pug b/src/includes/mentor/resources/detail.pug
index 5a63d5df..abd9c623 100644
--- a/src/includes/mentor/resources/detail.pug
+++ b/src/includes/mentor/resources/detail.pug
@@ -5,7 +5,7 @@ sib-router
 
 dialog#confirm_suppress
     h1 confirm_suppress
-    sib-delete(data-label="Die bitch, die !!" bind-resources) 
+    sib-delete(data-label="Delete" bind-resources) 
     sib-link(class="backlink pull-right", next="mentor-resource-list") X
 
 .block_log.block_creat_count.no_shadow
diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js
index f7ae8029..fc5334fa 100644
--- a/src/scripts/coopstarter.js
+++ b/src/scripts/coopstarter.js
@@ -37,32 +37,8 @@ function refreshList(formId, listId) {
   });
 }
 
-// //Refresh information after a deletion
-// function refreshAfterDeletion() {
-//   let list = document.getElementById("resources-history");
-//   console.log("list", list);
-
-//   let element = document.querySelectorAll("sib-delete");
-//   console.log("element", element);
-
-//   element.addEventListener("resourceDeleted", e => {
-//     console.log("Resource deleted: ", e.detail.resource);
-//     list.dataset.src = list.dataset.src;
-//   });
-
-// let form = document.querySelectorAll("button");
-// console.log("form", form);
-// form.addEventListener("click", event => {
-
-//   let list = document.getElementById("resources-history");
-//   console.log("delete");
-
-//   list.dataset.src = list.dataset.src;
-// });
-// }
-
 //Remove pagination when there is no resource in a step group
-function actualizePagination() {
+function refreshPagination() {
   var resources_containers = document.querySelectorAll(
     ".resource_by_step sib-form+div"
   );
@@ -80,13 +56,36 @@ function actualizePagination() {
 }
 
 //Manage select hidden to fullfill them with more "more criterias" selection
-function selectHiddenManagement() {
-  //Need to refactor the part
+function selectHiddenManagement(select_hidden, option_selected, form) {
+  options_hidden = select_hidden.getElementsByTagName("option");
+  for (let option_hidden of options_hidden) {
+    //Removing the selected attribute from previous selection
+    option_hidden.removeAttribute("selected");
+
+    if (option_hidden.value == option_selected.value) {
+      //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();
+  }
+  refreshPagination();
+  form.querySelector("sib-form").component.inputChange();
+}
+
+//Manage input hidden field to fullfill them with more "more criterias" selection
+function inputHiddenManagement(field, field_search, form) {
+  field.setAttribute("value", field_search.value);
+  refreshPagination();
+  form.querySelector("sib-form").component.inputChange();
 }
 
 jQuery(document).ready(function($) {
-  //Actualize pagination
-  actualizePagination();
+  //Refresh pagination
+  refreshPagination();
 
   // Get the element with id="defaultOpen" and click on it
   document.getElementById("defaultOpen").click();
@@ -133,7 +132,7 @@ jQuery(document).ready(function($) {
   forms.forEach(form => {
     form.addEventListener("populate", e => {
       //On load in dashbord Entrepreneur
-      actualizePagination();
+      refreshPagination();
       //SEARCH BY KEYWORD
       //To retrieve keyword
       //https://git.happy-dev.fr/startinblox/framework/sib-core/issues/379
@@ -149,7 +148,7 @@ jQuery(document).ready(function($) {
       keyword_submit.addEventListener("click", function() {
         keyword_hidden_fields.forEach(hidden_field => {
           hidden_field.setAttribute("value", keyword_field.value);
-          actualizePagination();
+          refreshPagination();
           form.querySelector("sib-form").component.inputChange();
         });
       });
@@ -171,7 +170,6 @@ jQuery(document).ready(function($) {
 
       // https://git.happy-dev.fr/startinblox/framework/sib-core/issues/453
       window.setTimeout(() => {
-
         //Refresh data list on delete resources
         const deleteButton = document.querySelectorAll("sib-delete");
 
@@ -184,7 +182,9 @@ jQuery(document).ready(function($) {
             confirm_suppress.setAttribute("hidden", "hidden");
 
             //If we supress from the detail resource view, we close this view.
-            let mentor_resource_detail = document.getElementById("mentor-resource-detail");
+            let mentor_resource_detail = document.getElementById(
+              "mentor-resource-detail"
+            );
             mentor_resource_detail.setAttribute("hidden", "hidden");
             this.dispatchEvent(
               new CustomEvent("requestNavigation", {
@@ -212,22 +212,7 @@ jQuery(document).ready(function($) {
           );
 
           format_hidden_field.forEach(function(select_hidden) {
-            options_hidden = select_hidden.getElementsByTagName("option");
-            for (let option_hidden of options_hidden) {
-              //Removing the selected attribute from previous selection
-              option_hidden.removeAttribute("selected");
-              if (option_hidden.value == option_selected.value) {
-                //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();
+            selectHiddenManagement(select_hidden, option_selected, form);
           });
         };
 
@@ -245,23 +230,7 @@ jQuery(document).ready(function($) {
           );
 
           language_hidden_field.forEach(function(select_hidden) {
-            options_hidden = select_hidden.getElementsByTagName("option");
-            for (let option_hidden of options_hidden) {
-              //Removing the selected attribute from previous selection
-              option_hidden.removeAttribute("selected");
-
-              if (option_hidden.value == option_selected.value) {
-                //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();
+            selectHiddenManagement(select_hidden, option_selected, form);
           });
         };
 
@@ -279,23 +248,7 @@ jQuery(document).ready(function($) {
           );
 
           field_hidden_field.forEach(function(select_hidden) {
-            options_hidden = select_hidden.getElementsByTagName("option");
-            for (let option_hidden of options_hidden) {
-              //Removing the selected attribute from previous selection
-              option_hidden.removeAttribute("selected");
-
-              if (option_hidden.value == option_selected.value) {
-                //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();
+            selectHiddenManagement(select_hidden, option_selected, form);
           });
         };
 
@@ -310,10 +263,8 @@ jQuery(document).ready(function($) {
         );
 
         year_field_search.addEventListener("input", function() {
-          year_hidden_fields.forEach(year_field => {
-            year_field.setAttribute("value", year_field_search.value);
-            actualizePagination();
-            form.querySelector("sib-form").component.inputChange();
+          year_hidden_fields.forEach(field => {
+            inputHiddenManagement(field, year_field_search, form);
           });
         });
 
@@ -326,10 +277,8 @@ jQuery(document).ready(function($) {
         );
 
         country_field_search.addEventListener("input", function() {
-          country_hidden_fields.forEach(country_field => {
-            country_field.setAttribute("value", country_field_search.value);
-            actualizePagination();
-            form.querySelector("sib-form").component.inputChange();
+          country_hidden_fields.forEach(field => {
+            inputHiddenManagement(field, country_field_search, form);
           });
         });
       }, 4000);
-- 
GitLab


From 573d3b78f1fb74a0b70cc8fd7adda26c2dc509fc Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Wed, 18 Sep 2019 16:02:19 +0200
Subject: [PATCH 13/13] Change the order of execution of the function
 refreshPagination.

---
 src/scripts/coopstarter.js | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js
index fc5334fa..b5ce30fd 100644
--- a/src/scripts/coopstarter.js
+++ b/src/scripts/coopstarter.js
@@ -72,15 +72,17 @@ function selectHiddenManagement(select_hidden, option_selected, form) {
     let parent_form = select_hidden.closest("sib-form");
     parent_form.component.inputChange();
   }
-  refreshPagination();
   form.querySelector("sib-form").component.inputChange();
+  refreshPagination();
+
 }
 
 //Manage input hidden field to fullfill them with more "more criterias" selection
 function inputHiddenManagement(field, field_search, form) {
   field.setAttribute("value", field_search.value);
-  refreshPagination();
   form.querySelector("sib-form").component.inputChange();
+  refreshPagination();
+
 }
 
 jQuery(document).ready(function($) {
@@ -148,8 +150,9 @@ jQuery(document).ready(function($) {
       keyword_submit.addEventListener("click", function() {
         keyword_hidden_fields.forEach(hidden_field => {
           hidden_field.setAttribute("value", keyword_field.value);
-          refreshPagination();
           form.querySelector("sib-form").component.inputChange();
+          refreshPagination();
+
         });
       });
 
-- 
GitLab