From 1042e5eaf722d0357a750b88f8f4c6783da9ed1d Mon Sep 17 00:00:00 2001 From: Alice <alice.poggioli@hotmail.fr> Date: Mon, 14 Oct 2019 14:19:59 +0200 Subject: [PATCH 1/6] add picture in detail profile entrepreneur account --- src/includes/entrepreneur/profile/detail.pug | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/includes/entrepreneur/profile/detail.pug b/src/includes/entrepreneur/profile/detail.pug index 66884ff8..e0099ead 100644 --- a/src/includes/entrepreneur/profile/detail.pug +++ b/src/includes/entrepreneur/profile/detail.pug @@ -25,8 +25,9 @@ div.block_list.flex sib-display#entrepreneur_info( bind-user - fields='name, entrepreneur_profile.organisation.name, registered_on' + fields='account.picture, name, entrepreneur_profile.organisation.name, registered_on' widget-name='cs-display-property' + widget-account.picture='cs-profile-picture' widget-entrepreneur_profile.organisation.name='cs-display-property' widget-entrepreneur_profile.registered_on='cs-display-property' ) -- GitLab From d925aec8029b63bdb8457ce70dcc3b91c2e3cb58 Mon Sep 17 00:00:00 2001 From: Alice <alice.poggioli@hotmail.fr> Date: Mon, 14 Oct 2019 15:43:45 +0200 Subject: [PATCH 2/6] Improve file form custom init. --- src/scripts/coopstarter.js | 39 ++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index 2f43bc72..f0c921e4 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -288,6 +288,24 @@ function manageLogoutButton() { } } +/** + * Initi the custom form file behaviour + * Todo : we can improve the performance adding param to reduce the loop + */ +function initFileUpload(){ + var previewImage = document.querySelectorAll( + "sib-form-file input[name='preview_image']+input" + ); + var previewlabel = document.querySelectorAll("sib-form-file div"); + for (let item of previewlabel) { + item.innerHTML = "Upload a file"; + } + + for (let item of previewImage) { + item.addEventListener("change", loadFile); + } +} + /** * For entrepreneur dashboard only : * As we cannot have multiple imbricated filtering with the native sib-display, we manage it manually. @@ -540,17 +558,8 @@ jQuery(document).ready(function($) { fillReportBrokenLinkForm(event, userWhoSubmitReport, formBrokenLink); }); - var previewImage = document.querySelectorAll( - "sib-form-file input[name='preview_image']+input" - ); - var previewlabel = document.querySelectorAll("sib-form-file div"); - for (let item of previewlabel) { - item.innerHTML = "Upload a file"; - } - - for (let item of previewImage) { - item.addEventListener("change", loadFile); - } + //Init the form file behaviour + initFileUpload() //Manage the accordion in request mentor dashboard. manageAccordionForRequest() @@ -596,8 +605,14 @@ jQuery(document).ready(function($) { window.setTimeout(() => { //Manage accordion by step manageAccordionByStep(); + + //Init the form file behaviour + initFileUpload() + + //Correct the native default of pagination refreshPagination(); - }, 2000); + }, 3000); + //In the entrepreneur dashboard, we set data from the display form to the hidden ones. addProperFilterToSearchComponents("entrepreneur-resource-list"); -- GitLab From 1af45d3db8854f7a0c9198aae5955ad6395efac5 Mon Sep 17 00:00:00 2001 From: Alice <alice.poggioli@hotmail.fr> Date: Mon, 14 Oct 2019 16:01:03 +0200 Subject: [PATCH 3/6] remove useless label. --- src/includes/entrepreneur/profile/edit.pug | 1 - 1 file changed, 1 deletion(-) diff --git a/src/includes/entrepreneur/profile/edit.pug b/src/includes/entrepreneur/profile/edit.pug index c18664c6..8028caf0 100644 --- a/src/includes/entrepreneur/profile/edit.pug +++ b/src/includes/entrepreneur/profile/edit.pug @@ -9,7 +9,6 @@ sib-form#entrepreneur_profile_edition.block_log.block_creat_count( label-first_name="Surname" label-last_name="Name" - label-username="Username" label-entrepreneur_profile.organisation="Organisation" label-account.picture="Profile picture" widget-username="sib-form-hidden" -- GitLab From 293bb959a194ccda424e51e4e09ae03ac3040d66 Mon Sep 17 00:00:00 2001 From: Alice <alice.poggioli@hotmail.fr> Date: Tue, 15 Oct 2019 09:12:03 +0200 Subject: [PATCH 4/6] Fix the bug on the pircture refresh. --- .../entrepreneur/components/header.pug | 2 +- src/includes/mentor/components/header.pug | 2 +- src/scripts/coopstarter.js | 27 ++++++++++++------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/includes/entrepreneur/components/header.pug b/src/includes/entrepreneur/components/header.pug index 2e707496..5d66d6b9 100644 --- a/src/includes/entrepreneur/components/header.pug +++ b/src/includes/entrepreneur/components/header.pug @@ -19,7 +19,7 @@ //- input.ico_droite.ico_search .dropdownWrapper - sib-display#user-account-picture.dropdownLabel( + sib-display#entrepreneur-account-picture.dropdownLabel( bind-user fields='account.picture', widget-account.picture='cs-account-picture' diff --git a/src/includes/mentor/components/header.pug b/src/includes/mentor/components/header.pug index 0f09c647..7ea9889c 100644 --- a/src/includes/mentor/components/header.pug +++ b/src/includes/mentor/components/header.pug @@ -19,7 +19,7 @@ //- input.ico_droite.ico_search .dropdownWrapper - sib-display#user-account-picture.dropdownLabel( + sib-display#mentor-account-picture.dropdownLabel( bind-user fields='account.picture', widget-account.picture='cs-account-picture' diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index f0c921e4..3514385e 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -513,20 +513,24 @@ jQuery(document).ready(function($) { refreshList("improvement-dialog-form", "pending-resources"); refreshList("entrepreneur_profile_creation", "entrepreneur_info"); refreshList("entrepreneur_profile_creation", "entrepreneur_contact"); - refreshList("entrepreneur_profile_creation", "user-account-picture"); + refreshList("entrepreneur_profile_creation", "entrepreneur-account-picture"); refreshList("mentor_profile_creation", "mentor_info"); refreshList("mentor_profile_creation", "mentor_complementary"); refreshList("mentor_profile_creation", "mentor_contact"); - refreshList("mentor_profile_creation", "user-account-picture"); + refreshList("mentor_profile_creation", "mentor-account-picture"); refreshList("entrepreneur_profile_edition", "entrepreneur_info"); refreshList("entrepreneur_profile_edition", "entrepreneur_contact"); - refreshList("entrepreneur_profile_edition", "user-account-picture"); + refreshList("entrepreneur_profile_edition", "entrepreneur-account-picture"); refreshList("mentor_profile_edition", "mentor_info"); refreshList("mentor_profile_edition", "mentor_complementary"); refreshList("mentor_profile_edition", "mentor_contact"); - refreshList("mentor_profile_edition", "user-account-picture"); + refreshList("mentor_profile_edition", "mentor-account-picture"); refreshList("change_status_request", "request-list"); + addProperFilterToSearchComponents("entrepreneur-resource-list"); + addProperFilterToSearchComponents("mentor-database"); + addProperFilterToSearchComponents("public-resource-list"); + var header_dropdown = $(".dropdownWrapper"), drop_choices = header_dropdown.find(".dropdownLabel"); @@ -611,11 +615,14 @@ jQuery(document).ready(function($) { //Correct the native default of pagination refreshPagination(); - }, 3000); - - //In the entrepreneur dashboard, we set data from the display form to the hidden ones. - addProperFilterToSearchComponents("entrepreneur-resource-list"); - addProperFilterToSearchComponents("mentor-database"); - addProperFilterToSearchComponents("public-resource-list"); + var forms = baseElement.querySelectorAll(".resource_by_step"); + forms.forEach(form => { + form.addEventListener("populate", e => { + let tab = document.getElementById("type1"); + selectHiddenManagementForType(tab, form); + }) + }) + + }, 3000); }); -- GitLab From 21bbcd8977f553dd69f33f0f7163749674299281 Mon Sep 17 00:00:00 2001 From: Alice <alice.poggioli@hotmail.fr> Date: Tue, 15 Oct 2019 10:56:01 +0200 Subject: [PATCH 5/6] =?UTF-8?q?Set=20type=201=20by=20default=20in=20entrep?= =?UTF-8?q?reneur,=20public=20dashboard=20and=20browse=20database.=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/includes/entrepreneur/resources/list.pug | 2 +- src/includes/mentor/browseDatabase.pug | 2 +- src/includes/public/resources/list.pug | 2 +- src/scripts/coopstarter.js | 51 +++++++++++++++----- 4 files changed, 43 insertions(+), 14 deletions(-) diff --git a/src/includes/entrepreneur/resources/list.pug b/src/includes/entrepreneur/resources/list.pug index 55cf9245..73f5a0ea 100644 --- a/src/includes/entrepreneur/resources/list.pug +++ b/src/includes/entrepreneur/resources/list.pug @@ -87,7 +87,7 @@ container.block_list.flex.flex_espace //Fake tabs to filter by type. div.tabs.flex_espace div(class='tablink filter_by_type active', onclick="openFakeTab(this)") - sib-display#type1( + sib-display.type1( data-src=`${endpoints.types}1/` fields='name' widget-name='fake-tabs' diff --git a/src/includes/mentor/browseDatabase.pug b/src/includes/mentor/browseDatabase.pug index e2f32bf9..003205f1 100644 --- a/src/includes/mentor/browseDatabase.pug +++ b/src/includes/mentor/browseDatabase.pug @@ -81,7 +81,7 @@ container.block_list.flex.flex_espace //Fake tabs to filter by type. div.tabs.flex_espace div(class='tablink filter_by_type active', onclick="openFakeTab(this)") - sib-display#type1( + sib-display.type1( data-src=`${endpoints.types}1/` fields='name' widget-name='fake-tabs' diff --git a/src/includes/public/resources/list.pug b/src/includes/public/resources/list.pug index ba13d1bf..6b4412cd 100644 --- a/src/includes/public/resources/list.pug +++ b/src/includes/public/resources/list.pug @@ -73,7 +73,7 @@ container.block_list.flex.flex_espace //Fake tabs to filter by type. div.tabs.flex_espace div(class='tablink filter_by_type active', onclick="openFakeTab(this)") - sib-display#type1( + sib-display.type1( data-src=`${endpoints.types}1/` fields='name' widget-name='fake-tabs' diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index 3514385e..29562264 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -195,6 +195,41 @@ function selectHiddenManagementForType(tab, form) { } } +/** + * Init type to type 1 + */ +function InitManagementForType() { + console.log("we enter in InitManagementForType"); + var forms = document.querySelectorAll(".resource_by_step"); + + forms.forEach(form => { + form.addEventListener( + "populate", + e => { + window.setTimeout(() => { + let type_hidden_field = form.querySelectorAll('select[name="type"]'); + type_hidden_field.forEach(function(select_hidden) { + options_hidden = select_hidden.getElementsByTagName("option"); + for (let option_hidden of options_hidden) { + option_hidden.removeAttribute("selected"); + if (option_hidden.value == '{"@id": "http://localhost:8000/types/1/"}') { + //Actually selecting the option if it is the good one + option_hidden.setAttribute("selected", "selected"); + select_hidden.setAttribute("value", option_hidden.value); + } + } + //Trigerring a reload of the associated form + let parent_form = select_hidden.closest("sib-form"); + parent_form.component.inputChange(); + refreshPagination(); + }); + }); + }, + 3000 + ); + }); +} + /** * Manage the report broken links hidden form */ @@ -494,6 +529,9 @@ jQuery(document).ready(function($) { //Refresh pagination refreshPagination(); + //init the fitering by step + InitManagementForType(); + // Get the element with id="defaultOpen" and click on it document.getElementById("defaultOpen").click(); @@ -611,18 +649,9 @@ jQuery(document).ready(function($) { manageAccordionByStep(); //Init the form file behaviour - initFileUpload() - + initFileUpload(); + //Correct the native default of pagination refreshPagination(); - - var forms = baseElement.querySelectorAll(".resource_by_step"); - forms.forEach(form => { - form.addEventListener("populate", e => { - let tab = document.getElementById("type1"); - selectHiddenManagementForType(tab, form); - }) - }) - }, 3000); }); -- GitLab From ce1da4a8a7ec477fb488584d0e43a1556634b00e Mon Sep 17 00:00:00 2001 From: Alice <alice.poggioli@hotmail.fr> Date: Wed, 16 Oct 2019 11:40:03 +0200 Subject: [PATCH 6/6] Fix the problem on rendering on public detail resource view. --- src/scripts/coopstarter.js | 1 - src/styles/index.scss | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index 29562264..1997b584 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -199,7 +199,6 @@ function selectHiddenManagementForType(tab, form) { * Init type to type 1 */ function InitManagementForType() { - console.log("we enter in InitManagementForType"); var forms = document.querySelectorAll(".resource_by_step"); forms.forEach(form => { diff --git a/src/styles/index.scss b/src/styles/index.scss index 665ec505..24d3f81b 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1333,7 +1333,7 @@ sib-set-default[name="submitter_info"]{ } } } -#mentor-resource-detail, #entrepreneur-resource-detail, #mentor-resource-validate{ +#mentor-resource-detail, #entrepreneur-resource-detail, #mentor-resource-validate, #public-resource-detail{ border: none; top: 0; padding: 0; -- GitLab