diff --git a/src/includes/account-creation.pug b/src/includes/account-creation.pug index 4c83f46b7ddfdfe7f070a49c3529891a18111d2b..a268f923950a30d7ea33dedeea962b298879f9d7 100644 --- a/src/includes/account-creation.pug +++ b/src/includes/account-creation.pug @@ -24,7 +24,7 @@ sib-router(default-route='account-creation-index') h2.button_base I am an entrepreneur #mentor-new-account(hidden).no-sidebar.container - include mentor/create.pug + include mentor/profile/create.pug #entrepreneur-new-account(hidden).no-sidebar.container - include entrepreneur/create.pug + include entrepreneur/profile/create.pug diff --git a/src/includes/components/widgets.pug b/src/includes/components/widgets.pug index fa37db5a7eb9f74e5bdfc9992c22768e4127239b..25f15b5049c7d4fd3a8fe4a04551743fe7d20c06 100644 --- a/src/includes/components/widgets.pug +++ b/src/includes/components/widgets.pug @@ -10,6 +10,13 @@ sib-widget(name='cs-display-property') template p ${value} +sib-widget(name='cs-steps-resources-multiple') + template + div.resource_resume_header + p ${value.name} + p ${value.publication_year} + p ${value.description} + sib-widget(name='cs-display-link') template p @@ -27,6 +34,11 @@ sib-widget(name='cs-display-title') template h3.title_lead_avenir ${label} +sib-widget(name='cs-display-checkbox') + template + label Search in Coopstarter database only + input(type='checkbox') + sib-widget(name='cs-display-related-property') template p #[a(href="${value.name}")] ${value.name} diff --git a/src/includes/entrepreneur/components/menu.pug b/src/includes/entrepreneur/components/menu.pug index 79869cdc9887ec34016828034c5f6dd3cfeefdb3..b69341d19cd3c24f102b4b5408e8ba5b4b1ac7fb 100644 --- a/src/includes/entrepreneur/components/menu.pug +++ b/src/includes/entrepreneur/components/menu.pug @@ -1,4 +1,5 @@ sib-router(default-route='entrepreneur-resource-list') sib-route(name='entrepreneur-resource-list') sib-route(name='entrepreneur-account', id-prefix=`${endpoints.users}`, use-id) + sib-route(name='entrepreneur-account-edit', id-prefix=`${endpoints.users}`, use-id) \ No newline at end of file diff --git a/src/includes/entrepreneur/dashboard.pug b/src/includes/entrepreneur/dashboard.pug index 69b824c5594f85c70dea7e375136b9f79519301b..422ad21fd8a727c97644a9127b34b4fcfdc5b62f 100644 --- a/src/includes/entrepreneur/dashboard.pug +++ b/src/includes/entrepreneur/dashboard.pug @@ -8,10 +8,6 @@ header#header(role='banner') section#home - h1 Mentorship program - - p International index of resources for cooperative mentors and entrepreneurs - //TODO: //-Distinguish the search form from the listing //-Create two Sib-displays getting the resources by "types" @@ -21,7 +17,7 @@ section#home //TODO : investigate why we have to remove hidden attribute to see this even if we are on the right route. - #entrepreneur-resource-list() + #entrepreneur-resource-list(hidden).no-sidebar.container include ./resources/list.pug sib-router @@ -36,5 +32,8 @@ section#home p.flex sib-link(next='entrepreneur-resource-list', class='button_base') Ok - #entrepreneur-account(hidden) - h2 account + #entrepreneur-account(hidden).no-sidebar.container + include profile/detail.pug + + #entrepreneur-account-edit(hidden).no-sidebar.container + include profile/edit.pug diff --git a/src/includes/entrepreneur/create.pug b/src/includes/entrepreneur/profile/create.pug similarity index 96% rename from src/includes/entrepreneur/create.pug rename to src/includes/entrepreneur/profile/create.pug index 1a07b3822f25844da13eaa7304eb218c0702815a..8eb14484cb31bbd26206253af3e000870482f81b 100644 --- a/src/includes/entrepreneur/create.pug +++ b/src/includes/entrepreneur/profile/create.pug @@ -1,4 +1,4 @@ -include ../components/widgets +include ../../components/widgets figure.logo img(src="../images/logo.png" diff --git a/src/includes/entrepreneur/profile/detail.pug b/src/includes/entrepreneur/profile/detail.pug new file mode 100644 index 0000000000000000000000000000000000000000..a597bd0cb78a454819cb3e489fde11c7854867d0 --- /dev/null +++ b/src/includes/entrepreneur/profile/detail.pug @@ -0,0 +1,40 @@ +include ../../components/widgets + +div.container_min + h2.title_lead.fd_bleu My Account + +div.block_list.flex + div.button__actions.w_25 + + div.dashboard__database + sib-link(next='entrepreneur-database') + div.button_base.ico_gauche.ico_database Browse database + + div.dashboard__database + sib-link(next='entrepreneur-resource-list') + div.button_base.ico_gauche.ico_search Back to dashboard + + div.dashboard__database + div.logout-button.button_base( + role='log out' + ) Logout + + div.profile_information.block_log.w_75 + sib-link(next='entrepreneur-account-edit') + button.button_edit Edit + + sib-display( + bind-user + fields='name, entrepreneur_profile.organisation.name, registered_on' + widget-name='cs-display-property' + widget-entrepreneur_profile.organisation.name='cs-display-property' + widget-entrepreneur_profile.registered_on='cs-display-property' + ) + + sib-display( + bind-user + fields='email' + label-email='Email:' + class-email="contact_profil" + widget-email='cs-display-resource-property' + ) \ No newline at end of file diff --git a/src/includes/entrepreneur/profile/edit.pug b/src/includes/entrepreneur/profile/edit.pug new file mode 100644 index 0000000000000000000000000000000000000000..3f0197f8e9e1544b6b7090b085ca80eeeb182f91 --- /dev/null +++ b/src/includes/entrepreneur/profile/edit.pug @@ -0,0 +1,29 @@ +include ../../components/widgets + +h2.title_create Edit your account + +sib-form.block_log.block_creat_count( + bind-user + fields="last_name, first_name, username, email, entrepreneur_profile.organisation" + + range-entrepreneur_profile.organisation=`${endpoints.organisations}` + + label-first_name="Surname" + label-last_name="Name" + label-username="Username" + label-entrepreneur_profile.organisation="Organisation" + + widget-username="sib-form-hidden" + + class-last_name='form-label is-dark input_big' + class-first_name='form-label is-dark input_big' + class-email='form-label is-dark input_big' + class-entrepreneur_profile.phone='form-label is-dark input_big' + + class-entrepreneur_profile.organisation='form-label is-dark input_big' + multiple-entrepreneur_profile.organisation='sib-multiple-select' + widget-entrepreneur_profile.organisation='sib-form-auto-completion' + + submit-button="Save modifications" + next='entrepreneur-resource-list' +) \ No newline at end of file diff --git a/src/includes/entrepreneur/requests/create.pug b/src/includes/entrepreneur/requests/create.pug index 2692e978b0013ebc97d37b09773d529990e493c0..36925b483395bb5ab8b99c4ec53f16ff6b6d9a34 100644 --- a/src/includes/entrepreneur/requests/create.pug +++ b/src/includes/entrepreneur/requests/create.pug @@ -1,4 +1,5 @@ h2 Request a ressource +sib-link(class="backlink", next="entrepreneur-resource-list") X p You can't find a resource you are looking for ? You need resources to acquire certain skills or progress in your cooperative developement ? It can be a book, a document model, a tutorial, anything you need, make a request to our mentors so they know how to help you. @@ -39,6 +40,6 @@ p You can't find a resource you are looking for ? You need resources to acquire next="entrepreneur-request-validation" ) - sib-link(class="backlink", next="entrepreneur-resource-list") Back to the dashboard + diff --git a/src/includes/entrepreneur/resources/list.pug b/src/includes/entrepreneur/resources/list.pug index 3270dd35941a566cf8d0a8c210bb3cd9b097d1a2..ce0a0ceeef823cad6f30707c3ee942fa58b60983 100644 --- a/src/includes/entrepreneur/resources/list.pug +++ b/src/includes/entrepreneur/resources/list.pug @@ -1,23 +1,66 @@ include ../../components/widgets -p: a Watch a video presentation +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 + +h2.title_form Search for a resource + +//-Question : +//In my opinion, "multiple ressource" solution is closer to the wanted result than the "group-by" solution + +//Maybe we sould think from now how we gonna manage the type filter + +//What's the best way to retrieve the name of the format? By the resource we get a number. Sould we manage this with a 'switch/case' in js? + +//It seems that we don't have likes and dislikes data : sould i ignore them for the moment? + +// -h2 Search for a resource #circles + sib-widget(name="group-by-steps") + template + strong(data-content) + p.p_entete(data-title) ${value.name} + sib-display#circles-list( data-src=`${endpoints.resources}`, - fields='name, description, format, info(author, publication_year, language.name), steps', - search-fields='name, description, format', - widget-format='cs-resource-format-name', - multiple-format, - - widget-steps='cs-resource-format-name', - multiple-steps, - - paginate-by="1" - next='detail' + fields='keyword(name, description, author),\ + steps.name,\ + more_criterias( format, publication_year, country, language.name, fields, steps)' + + 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' ) + div.side-block p Can't find the ressource you need ? diff --git a/src/includes/mentor/components/menu.pug b/src/includes/mentor/components/menu.pug index 8dc3954f695aeb56a8e3ca2cbe71c2d066ef0ae2..f52aa70cbaa020513d84cabf4d20d5bea6b0c172 100644 --- a/src/includes/mentor/components/menu.pug +++ b/src/includes/mentor/components/menu.pug @@ -1,6 +1,7 @@ sib-router(default-route='mentor-resource-list') sib-route(name='mentor-resource-list') sib-route(name='mentor-account', id-prefix=`${endpoints.users}`, use-id) + sib-route(name='mentor-account-edit', id-prefix=`${endpoints.users}`, use-id) sib-ac-checker(permission="acl:Write") sib-route(name='mentor-resource-create') sib-ac-checker(permission="acl:Write" bind-resources) diff --git a/src/includes/mentor/dashboard.pug b/src/includes/mentor/dashboard.pug index 77b3b6035392b82f59cea967415e3a0fb9175d02..245cf662f7ebaf9f5ef8a9837bdd2c63c11ba4d7 100644 --- a/src/includes/mentor/dashboard.pug +++ b/src/includes/mentor/dashboard.pug @@ -43,4 +43,9 @@ section#home include resources/list.pug #mentor-account(hidden).no-sidebar.container - include profile.pug + include profile/detail.pug + + #mentor-account-edit(hidden).no-sidebar.container + include profile/edit.pug + + diff --git a/src/includes/mentor/create.pug b/src/includes/mentor/profile/create.pug similarity index 98% rename from src/includes/mentor/create.pug rename to src/includes/mentor/profile/create.pug index 3b6d162d18bce98a36375810fc0f4c5639acab02..96049e4fcfaca9a2e2f3df66908c8c3b54860b43 100644 --- a/src/includes/mentor/create.pug +++ b/src/includes/mentor/profile/create.pug @@ -1,4 +1,4 @@ -include ../components/widgets +include ../../components/widgets figure.logo img(src="../images/logo.png" diff --git a/src/includes/mentor/profile.pug b/src/includes/mentor/profile/detail.pug similarity index 94% rename from src/includes/mentor/profile.pug rename to src/includes/mentor/profile/detail.pug index 55c9374b73295a8c7c57a8d8a8ee59c1031ae65c..00a95bf89c4aebfbc3d6f31e86fdc545a09fa84b 100644 --- a/src/includes/mentor/profile.pug +++ b/src/includes/mentor/profile/detail.pug @@ -1,4 +1,4 @@ -include ../components/widgets +include ../../components/widgets div.container_min h2.title_lead.fd_bleu My Account @@ -19,11 +19,14 @@ div.block_list.flex div.button_base.ico_gauche.ico_search Back to dashboard div.dashboard__database - div#logout-button.button_base( + div.logout-button.button_base( role='log out' ) Logout div.profile_information.block_log.w_75 + sib-link(next='mentor-account-edit') + button.button_edit Edit + sib-display( bind-user fields='account.picture, name, mentor_profile.headline, mentor_profile.city, mentor_profile.country, registered_on' diff --git a/src/includes/mentor/profile/edit.pug b/src/includes/mentor/profile/edit.pug new file mode 100644 index 0000000000000000000000000000000000000000..09a9e2b732f67824bc943fc14f0aa01902deb125 --- /dev/null +++ b/src/includes/mentor/profile/edit.pug @@ -0,0 +1,62 @@ +include ../../components/widgets + +h2.title_create Edit you account + +sib-form.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),\ + about_you(header_about_you, account.picture, mentor_profile.headline, mentor_profile.city, mentor_profile.country,\ + mentor_profile.biography, mentor_profile.skills),\ + social_media(header_social_media, mentor_profile.linkedin, mentor_profile.twitter), username" + + range-mentor_profile.fields=`${endpoints.fields}` + range-mentor_profile.organisation=`${endpoints.organisations}` + range-mentor_profile.languages=`${endpoints.languages}` + + label-header_about_you="About you" + label-header_social_media="Social medias" + + widget-header_social_media="cs-section_header" + widget-header_about_you="cs-section_introduction" + + label-first_name="Surname" + label-last_name="Name" + label-mentor_profile.organisation="Organisation" + label-mentor_profile.phone="Phone number" + label-mentor_profile.languages="Languages" + label-mentor_profile.fields="Fields" + label-account.picture="Photo" + label-mentor_profile.headline="Headline or current position" + class-mentor_profile.headline="w_75" + label-mentor_profile.city="City" + label-mentor_profile.country="Country" + label-mentor_profile.biography="Tell us more about your activities" + label-mentor_profile.skills="What skills can you share with our entrepreneurs ?" + label-mentor_profile.linkedin="Linkedin" + label-mentor_profile.twitter="Twitter" + + widget-mentor_profile.skills="sib-form-textarea" + widget-mentor_profile.biography="sib-form-textarea" + widget-username="sib-form-hidden" + + class-mentor_profile.organisation='form-label is-dark' + multiple-mentor_profile.organisation='sib-multiple-select' + widget-mentor_profile.organisation='sib-form-auto-completion' + + class-mentor_profile.languages='form-label is-dark' + multiple-mentor_profile.languages='sib-multiple-select' + widget-mentor_profile.languages='sib-form-auto-completion' + + class-mentor_profile.fields='form-label is-dark' + multiple-mentor_profile.fields='sib-multiple-select' + widget-mentor_profile.fields='sib-form-auto-completion' + + upload-url-account.picture=`${sdn}/upload/` + widget-account.picture='sib-form-file' + class-account.picture='input_photo w_25' + class-headline='w_75' + + submit-button="Save modifications" + next='mentor-dashboard' +) \ No newline at end of file diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index 73ff168c2b5ea01386cdfd1e3bdebaa7d5778070..3526ae6756e2ea91dde0c020085e41d779860fc4 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -1,58 +1,67 @@ function openTab(pageName, elmnt) { - // Hide all elements with class="tabcontent" by default */ - var i, tabcontent, tablinks; - tabcontent = document.getElementsByClassName("tabcontent"); - tablinks = document.getElementsByClassName("tablink"); - - for (i = 0; i < tabcontent.length; i++) { - tabcontent[i].style.display = "none"; - tablinks[i].classList.remove("active"); - } - - // Show the specific tab content - document.getElementById(pageName).style.display = "block"; - elmnt.classList.add("active"); + // Hide all elements with class="tabcontent" by default */ + var i, tabcontent, tablinks; + tabcontent = document.getElementsByClassName("tabcontent"); + tablinks = document.getElementsByClassName("tablink"); + + for (i = 0; i < tabcontent.length; i++) { + tabcontent[i].style.display = "none"; + tablinks[i].classList.remove("active"); + } + + // Show the specific tab content + document.getElementById(pageName).style.display = "block"; + elmnt.classList.add("active"); } function linkDatasetToField(detail, targetFormName, inputName) { - let targetForm = document.getElementById(targetFormName); - targetForm.addEventListener("populate", event => { - let resourceField = targetForm.querySelector(`input[name="${inputName}"]`); - if (resourceField) { - resourceField.value = JSON.stringify({ '@id': detail.dataset.src }); - resourceField.setAttribute('value', JSON.stringify({ '@id': detail.dataset.src })); - } - }); + let targetForm = document.getElementById(targetFormName); + targetForm.addEventListener("populate", event => { + let resourceField = targetForm.querySelector(`input[name="${inputName}"]`); + if (resourceField) { + resourceField.value = JSON.stringify({ "@id": detail.dataset.src }); + resourceField.setAttribute( + "value", + JSON.stringify({ "@id": detail.dataset.src }) + ); + } + }); } function refreshList(formId, listId) { - let form = document.getElementById(formId); - form.addEventListener("save", event => { - let list = document.getElementById(listId); - list.dataset.src = list.dataset.src; - }); + let form = document.getElementById(formId); + form.addEventListener("save", event => { + let list = document.getElementById(listId); + list.dataset.src = list.dataset.src; + }); } -jQuery(document).ready(function($) { - // Get the element with id="defaultOpen" and click on it - document.getElementById("defaultOpen").click(); - - let userAccountDataSrc = document.getElementById("user-account-picture"); - linkDatasetToField(userAccountDataSrc, 'validation-form', 'reviewer'); - linkDatasetToField(userAccountDataSrc, 'improvement-dialog-form', 'reviewer'); - linkDatasetToField(userAccountDataSrc, 'refusal-dialog-form', 'reviewer'); - - refreshList("resource-creation-form", "resources-history"); - refreshList("validation-form", "pending-resources"); - refreshList("refusal-dialog-form", "pending-resources"); - refreshList("improvement-dialog-form", "pending-resources"); - - const logoutButton = document.getElementById('logout-button'); - logoutButton.addEventListener('click', function() { - window.dispatchEvent( - new CustomEvent('requestNavigation', { detail: { route: 'splash-index' } }) - ); - document.querySelector('sib-auth').logout(); - setTimeout(function(){ location.reload(); }, 1000); - }) - }); \ No newline at end of file +jQuery(document).ready(function($) { + // Get the element with id="defaultOpen" and click on it + document.getElementById("defaultOpen").click(); + + let userAccountDataSrc = document.getElementById("user-account-picture"); + linkDatasetToField(userAccountDataSrc, "validation-form", "reviewer"); + linkDatasetToField(userAccountDataSrc, "improvement-dialog-form", "reviewer"); + linkDatasetToField(userAccountDataSrc, "refusal-dialog-form", "reviewer"); + + refreshList("resource-creation-form", "resources-history"); + refreshList("validation-form", "pending-resources"); + refreshList("refusal-dialog-form", "pending-resources"); + refreshList("improvement-dialog-form", "pending-resources"); + + const logoutButtons = document.getElementsByClassName("logout-button"); + for (var i = 0; i < logoutButtons.length; i++) { + logoutButtons[i].addEventListener("click", function() { + window.dispatchEvent( + new CustomEvent("requestNavigation", { + detail: { route: "splash-index" } + }) + ); + document.querySelector("sib-auth").logout(); + setTimeout(function() { + location.reload(); + }, 1000); + }); + } +});