From 4714a246baa93bd0b3d9818d75bfedcf213cea5d Mon Sep 17 00:00:00 2001 From: Alice <alice.poggioli@hotmail.fr> Date: Thu, 19 Sep 2019 10:05:40 +0200 Subject: [PATCH] WIP: filter by type, but problem of latency. --- src/includes/entrepreneur/dashboard.pug | 3 --- src/includes/entrepreneur/resources/list.pug | 9 +++++---- src/scripts/coopstarter.js | 3 +++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/includes/entrepreneur/dashboard.pug b/src/includes/entrepreneur/dashboard.pug index e91bebd0..106a3a99 100644 --- a/src/includes/entrepreneur/dashboard.pug +++ b/src/includes/entrepreneur/dashboard.pug @@ -7,9 +7,6 @@ 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 //-Create two Sib-displays getting the resources by "types" diff --git a/src/includes/entrepreneur/resources/list.pug b/src/includes/entrepreneur/resources/list.pug index c52c6192..484ccf81 100644 --- a/src/includes/entrepreneur/resources/list.pug +++ b/src/includes/entrepreneur/resources/list.pug @@ -14,9 +14,12 @@ container.block_list.flex.flex_espace div.w_75.block-g-entre div h2.title_form Search for a resource + div#resources-loader + hidden Loading resources, please wait... + sib-form#search-by-keyword( data-src=`${endpoints.resources}`, - loader-id="coopstarter-loader" + loader-id="resources-loader" fields='keyword(name_keyword, description, author)' label-keyword="Search by author, name..." widget-keyword="sib-form-placeholder-text" @@ -75,9 +78,7 @@ container.block_list.flex.flex_espace div div.button_base Make a request - div#resources-loader - hidden Loading resources, please wait... - + //Fake tabs to filter by type. div.tabs.flex_espace div(class='tablink filter_by_type active', onclick="openFakeTab(this)") diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index 65b07427..b5731095 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -201,10 +201,13 @@ jQuery(document).ready(function($) { type_hidden_field.forEach(function(select_hidden) { options_hidden = select_hidden.getElementsByTagName("option"); for (let option_hidden of options_hidden) { + option_hidden.removeAttribute("selected"); if (option_hidden.value == '{"@id": "'+type_field_search+'"}') { //Actually selecting the option if it is the good one option_hidden.setAttribute("selected", "selected"); select_hidden.setAttribute("value", option_hidden.value); + form.querySelector("sib-form").component.inputChange(); + refreshPagination(); } } //Trigerring a reload of the associated form -- GitLab