diff --git a/src/includes/components/widgets.pug b/src/includes/components/widgets.pug index 3cfc84ad0df1f5fef86db92a3487690bc6b15adb..b8de6880ae50035538ff0cde33e4dcdcd9f109c9 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/entrepreneur/profile/create.pug b/src/includes/entrepreneur/profile/create.pug index ce0cb42cab5e95efc21fe711136035d21d78934a..a76b9c9717ee9fbdc7fe9a7ee63e1cca662c7077 100644 --- a/src/includes/entrepreneur/profile/create.pug +++ b/src/includes/entrepreneur/profile/create.pug @@ -12,7 +12,7 @@ h2.title_create Complete your entrepreneur account sib-form#entrepreneur_profile_creation.block_log.block_creat_count( bind-user - fields="last_name, first_name, entrepreneur_profile.organisation, username" + fields="last_name, first_name, entrepreneur_profile.organisation, account.picture, username" range-entrepreneur_profile.organisation=`${endpoints.organisations}` @@ -25,6 +25,10 @@ sib-form#entrepreneur_profile_creation.block_log.block_creat_count( widget-entrepreneur_profile.organisation='sib-form-auto-completion' widget-username='sib-form-hidden' + + upload-url-account.picture=`${sdn}upload/` + widget-account.picture='sib-form-file' + class-account.picture='input_photo w_25' submit-button="COMPLETE YOUR ACCOUNT" next="entrepreneur-dashboard" diff --git a/src/includes/entrepreneur/profile/edit.pug b/src/includes/entrepreneur/profile/edit.pug index fc5da4bc0021d19f2d1d8a97ac4b200708c55d57..a783c83260e8f158e2cf99c71dc6e3640fc257b0 100644 --- a/src/includes/entrepreneur/profile/edit.pug +++ b/src/includes/entrepreneur/profile/edit.pug @@ -4,7 +4,7 @@ h2.title_create Edit your account sib-form#entrepreneur_profile_edition.block_log.block_creat_count( bind-user - fields="info(last_name, first_name, username, email, entrepreneur_profile.organisation)" + fields="info(last_name, first_name, username, email, entrepreneur_profile.organisation, account.picture)" range-entrepreneur_profile.organisation=`${endpoints.organisations}` label-first_name="Surname" @@ -23,6 +23,10 @@ sib-form#entrepreneur_profile_edition.block_log.block_creat_count( multiple-entrepreneur_profile.organisation='sib-multiple-select' widget-entrepreneur_profile.organisation='sib-form-auto-completion' + upload-url-account.picture=`${sdn}upload/` + widget-account.picture='sib-form-file' + class-account.picture='input_photo w_25' + submit-button="Save modifications" next='entrepreneur-resource-list' ) diff --git a/src/includes/mentor/dashboard.pug b/src/includes/mentor/dashboard.pug index fc8f613b000d2de63fb05220e354fb2916fdc137..d27b1086ffc92656efe1fc7fdea92a04c4dbe13d 100644 --- a/src/includes/mentor/dashboard.pug +++ b/src/includes/mentor/dashboard.pug @@ -18,15 +18,19 @@ 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 - sib-link(class="backlink", next="mentor-resource-list") Back to the dashboard dialog#mentor-resource-validate.no-sidebar.container 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 +51,7 @@ section#home #mentor-account-edit(hidden).no-sidebar.container include profile/edit.pug + + diff --git a/src/includes/mentor/profile/create.pug b/src/includes/mentor/profile/create.pug index 17f7c8f75f9c65492c761857cf429925ed7b42b0..d1bf6235698182dbffd04a069e3e9cd9f0190ef2 100644 --- a/src/includes/mentor/profile/create.pug +++ b/src/includes/mentor/profile/create.pug @@ -60,7 +60,7 @@ sib-form#mentor_profile_creation.block_log.block_creat_count( multiple-mentor_profile.fields='sib-multiple-select' widget-mentor_profile.fields='sib-form-auto-completion' - upload-url-account.picture=`${sdn}/upload/` + upload-url-account.picture=`${sdn}upload/` widget-account.picture='sib-form-file' class-account.picture='input_photo w_25' class-headline='w_75' diff --git a/src/includes/mentor/profile/edit.pug b/src/includes/mentor/profile/edit.pug index 1cdcc94f189ee19f68b087c647354c29d67480ca..556b71bb9b3b16609624e8cd86a40edd56d34076 100644 --- a/src/includes/mentor/profile/edit.pug +++ b/src/includes/mentor/profile/edit.pug @@ -52,13 +52,11 @@ sib-form#mentor_profile_edition.block_log.block_creat_count( multiple-mentor_profile.fields='sib-multiple-select' widget-mentor_profile.fields='sib-form-auto-completion' - upload-url-account.picture=`${sdn}/upload/` + 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' + next='mentor-resource-list' ) - -sib-link(class="backlink", next="mentor-resource-list") Back to the dashboard \ No newline at end of file diff --git a/src/includes/mentor/resources/confirmation.pug b/src/includes/mentor/resources/confirmation.pug index 2e2bd1aa3fa235e6a64a914cee379d3185bedf9a..964d2811175285abc28c892dfb73615d595c3d7b 100644 --- a/src/includes/mentor/resources/confirmation.pug +++ b/src/includes/mentor/resources/confirmation.pug @@ -10,7 +10,15 @@ 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 pull-right", next="resource-validation-process_confirmation") What is a validation process ? div.flex h3.button_base diff --git a/src/includes/mentor/resources/create.pug b/src/includes/mentor/resources/create.pug index 7ba9d9b1219fe2de81020f2ab2a37b7e3620a757..bc9083862429f6cb1788c5fd9ce5c17dc4f691af 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' @@ -76,6 +76,10 @@ p.p_entete Thank you for enriching our database ! widget-skills='sib-form-textarea' widget-publication_year='sib-form-number' + upload-url-preview_image=`${sdn}upload/` + widget-preview_image='sib-form-file' + class-preview_image='input_photo w_25' + submit-button='Send for validation ->' next="resource-creation-confirmation" ) \ No newline at end of file diff --git a/src/includes/mentor/resources/detail.pug b/src/includes/mentor/resources/detail.pug index 427645b0745e0611f93b8ebb5bcdc810d9bfbce7..4dd59199a3c9d02a41bbda48243a47a5f693962c 100644 --- a/src/includes/mentor/resources/detail.pug +++ b/src/includes/mentor/resources/detail.pug @@ -1,20 +1,24 @@ include ../../components/widgets .block_log.block_creat_count.no_shadow + sib-link(class="backlink", next="mentor-resource-list") + .like + p.backlink + i.fas.fa-times + sib-display( bind-resources, fields='name, steps, format, content(preview_image, tags),\ submitter_info(submitter.account.picture, submitter.name, \ submitter.mentor_profile.organisation.name, skills, uri, broken),\ - description, review.status, review.reviewer.account.picture, review.reviewer.name, copyright, specifications(\ + description, review.reviewer.account.picture, review.reviewer.name,\ + copyright, specifications(\ header_specifications, author, country, language.name,\ - publication_year, fields, sharing), \ - edit', + publication_year, fields, sharing)', widget-submitter.name='cs-display-resource-property', class-name="title_form" class-steps="steps" - widget-edit='sib-action', widget-author='cs-display-resource-property', widget-country='cs-display-resource-property', widget-submitter.mentor_profile.organisation.name='cs-display-resource-property' @@ -31,7 +35,7 @@ include ../../components/widgets widget-language.name='cs-display-resource-property' widget-submitter.account.picture='cs-account-picture' widget-broken='cs-broken-action' - widget-review.status='cs-resource-status' + widget-preview_image='cs-profile-picture' widget-review.reviewer.account.picture='cs-account-picture' widget-review.reviewer.name='cs-resource-reviewer' class-review.reviewer.name="validator_ressource" @@ -60,12 +64,9 @@ include ../../components/widgets label-uri='Link to resource' name-uri='original-link' label-country='Country:' - label-submitter.mentor_profile.organisation.name='Organisation:', - label-author='Author :', - label-submitter.name='Resource posted by:', - label-edit='Edit', - label-review='' - action-edit='mentor-resource-edit', + label-submitter.mentor_profile.organisation.name='Organisation:' + label-author='Author :' + label-submitter.name='Resource posted by:' action-broken='resource-report-broken-link' ) @@ -74,9 +75,7 @@ include ../../components/widgets <p class="backlink"><i class='far fa-thumbs-up'></i>18</p> <p class="backlink"><i class='far fa-thumbs-down'></i>3</p> </div> - <div class="like"> - <p class="backlink"><i class="fas fa-times"></i></p> - </div> + sib-display( bind-resources fields="" @@ -103,6 +102,8 @@ include ../../components/widgets id-suffix="conversations" ) + h2.title_lead_avenir Related resources + sib-display( bind-resources, nested-field="related" @@ -115,4 +116,5 @@ include ../../components/widgets ) + \ No newline at end of file diff --git a/src/includes/mentor/resources/edit.pug b/src/includes/mentor/resources/edit.pug index 3243643d7f5c3a4fad2b0e1a7ab4e85adeb47005..66dc47a260a3e80336f0216fe750faaf95e785e7 100644 --- a/src/includes/mentor/resources/edit.pug +++ b/src/includes/mentor/resources/edit.pug @@ -76,6 +76,10 @@ p.p_entete Thank you for enriching our database ! widget-skills='sib-form-textarea' widget-publication_year='sib-form-number' + upload-url-preview_image=`${sdn}upload/` + widget-preview_image='sib-form-file' + class-preview_image='input_photo w_25' + submit-button='Send for validation ->' next="resource-creation-confirmation" ) \ No newline at end of file diff --git a/src/includes/mentor/resources/list.pug b/src/includes/mentor/resources/list.pug index 8fcfea89d469221d74f8c25c993577c3b7bf8823..f5bcf2f2e5c2a07703beb9171c92fbe7472db0d7 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,8 +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', @@ -41,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', @@ -60,17 +78,48 @@ 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' - 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='' @@ -93,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 c998511eb3d02e9103493d41fb00077cd93283c4..2f9b67434a852ce339e2a20bb9a745e2534c2dde 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -40,6 +40,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 => { @@ -49,7 +50,7 @@ function refreshList(formId, listId) { } //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" ); @@ -67,13 +68,38 @@ 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(); + } + 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); + form.querySelector("sib-form").component.inputChange(); + refreshPagination(); + } jQuery(document).ready(function($) { - //Actualize pagination - actualizePagination() + //Refresh pagination + refreshPagination(); + // Get the element with id="defaultOpen" and click on it document.getElementById("defaultOpen").click(); @@ -119,7 +145,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 @@ -135,8 +161,9 @@ 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(); + refreshPagination(); + }); }); @@ -181,11 +208,40 @@ jQuery(document).ready(function($) { 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(); }); } }); } + + //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 @@ -203,22 +259,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); }); }; @@ -236,23 +277,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); }); }; @@ -270,23 +295,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); }); }; @@ -301,10 +310,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); }); }); @@ -317,10 +324,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); diff --git a/src/styles/index.scss b/src/styles/index.scss index 93df0a0aba6652c75e05f0c64aa1216bf29f980f..4681eb3a6f034e582059e8f5427bd667e9aa054b 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%; }