From 996cafe9c5a9d00b17ec21329b71f252a2a166a0 Mon Sep 17 00:00:00 2001
From: Alice <alice.poggioli@hotmail.fr>
Date: Thu, 12 Sep 2019 10:25:10 +0200
Subject: [PATCH] WIP: Filter resource with js.

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

diff --git a/src/includes/entrepreneur/resources/list.pug b/src/includes/entrepreneur/resources/list.pug
index 029edb1e..6cd839a3 100644
--- a/src/includes/entrepreneur/resources/list.pug
+++ b/src/includes/entrepreneur/resources/list.pug
@@ -12,7 +12,7 @@ include ../../components/widgets
 //It seems that we don't have likes and dislikes data : sould i ignore them for the moment?
 
 
-div.block_log.block_list
+.block_log.block_creat_count
     h2.title_form Search for a resource
     sib-form#search-by-keyword(
         data-src=`${endpoints.resources}`,
@@ -23,20 +23,31 @@ div.block_log.block_list
         widget-description='cs-display-property'
         widget-name_keyword='cs-display-property'
         widget-author='cs-display-property'
+
+        submit-button='Search'
+    )
+
+    sib-form(
+        data-src=`${endpoints.resources}`,
+        fields='instance_database_only'    
+
+        widget-instance_database_only='cs-display-checkbox'
+
+        class-instance_database_only = 'ss-list checkbox'
+        naked
     )
 
-    sib-form#circles-list(
+    sib-form(
         data-src=`${endpoints.resources}`,
-        fields='more_criterias( format, publication_year, country, language.name, fields, steps)'
+        fields='header_criterias, format, publication_year, country, language.name, fields, steps'
         
         label-header_criterias='More criterias'
-        label-format='Format'
+        label-format='Format:'
         label-publication_year='Year of publication'
         label-country='Country of publication'
         label-language.name='Language'
         label-fields='Field'
         label-steps='Step of : Staring up a cooperative business'
-        widget-instance_database_only='cs-display-checkbox'
         widget-header_criterias='cs-section_header'
 
         range-language.name=`${endpoints.languages}`
@@ -44,30 +55,21 @@ div.block_log.block_list
         range-steps=`${endpoints.steps}`
         range-format=`${endpoints.formats}`
 
-        multiple-language='sib-multiple-select'
-        widget-language='sib-form-auto-completion'
+        multiple-language.name='sib-multiple-select'
+        widget-language.name='sib-form-auto-completion'
 
-        multiple-field='sib-multiple-select'
-        widget-field='sib-form-auto-completion'
+        multiple-format='sib-multiple-select'
+        widget-format='sib-form-auto-completion'
 
-        multiple-step='sib-multiple-select'
-        widget-step='sib-form-auto-completion'
-                
-    
+        multiple-fields='sib-multiple-select'
+        widget-fields='sib-form-auto-completion'
 
+        multiple-steps='sib-multiple-select'
+        widget-steps='sib-form-auto-completion'
+                
         naked
     )
 
-//- form
-//-     div
-//-         label(for="name") Enter your name
-//-         input(type="text" name="name" id="name" )
-    
-//-     div
-//-         button(value="Search")
-
-
-
 
 #circles
     sib-display#circles-list(
diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js
index 48f0f3c8..e9084b23 100644
--- a/src/scripts/coopstarter.js
+++ b/src/scripts/coopstarter.js
@@ -69,7 +69,7 @@ jQuery(document).ready(function($) {
             hidden_fields.forEach(hidden_field => {
                 hidden_field.setAttribute("value", keyword_field.value)
                 console.log(hidden_fields)
-                console.log("element.value", hidden_field.value)
+                console.log("hidden_field.value", hidden_field.value)
                 console.log("keyword_field.value", keyword_field.value)
             }); 
         })     
-- 
GitLab