diff --git a/src/includes/components/widgets.pug b/src/includes/components/widgets.pug index e605891a84e2b9c2f28db54253bee4b5e4992912..dd460b9db7faadabb8043c805c31bc20deecd866 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/dashboard.pug b/src/includes/entrepreneur/dashboard.pug index 422ad21fd8a727c97644a9127b34b4fcfdc5b62f..e91bebd00b6ce36ef844d0efce9bdcbc8a8faddb 100644 --- a/src/includes/entrepreneur/dashboard.pug +++ b/src/includes/entrepreneur/dashboard.pug @@ -7,6 +7,8 @@ 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 diff --git a/src/includes/entrepreneur/profile/edit.pug b/src/includes/entrepreneur/profile/edit.pug index 7ec09b53a0ef350ad1e5a8e17de7bb7efae9b61a..a783c83260e8f158e2cf99c71dc6e3640fc257b0 100644 --- a/src/includes/entrepreneur/profile/edit.pug +++ b/src/includes/entrepreneur/profile/edit.pug @@ -2,7 +2,7 @@ include ../../components/widgets h2.title_create Edit your account -sib-form.block_log.block_creat_count( +sib-form#entrepreneur_profile_edition.block_log.block_creat_count( bind-user fields="info(last_name, first_name, username, email, entrepreneur_profile.organisation, account.picture)" range-entrepreneur_profile.organisation=`${endpoints.organisations}` @@ -29,4 +29,6 @@ sib-form.block_log.block_creat_count( submit-button="Save modifications" next='entrepreneur-resource-list' -) \ No newline at end of file +) + +sib-link(class="backlink", next="entrepreneur-resource-list") Back to the dashboard \ No newline at end of file diff --git a/src/includes/entrepreneur/resources/list.pug b/src/includes/entrepreneur/resources/list.pug index a91cde0256ae36102c01f4d530b585397b2bdce0..124b14c5c3dc4606196f7ec7342c0d708f7562e9 100644 --- a/src/includes/entrepreneur/resources/list.pug +++ b/src/includes/entrepreneur/resources/list.pug @@ -16,6 +16,7 @@ container.block_list.flex.flex_espace h2.title_form Search for a resource sib-form#search-by-keyword( data-src=`${endpoints.resources}`, + loader-id="coopstarter-loader" fields='keyword(name_keyword, description, author)' label-keyword="Search by author, name..." widget-keyword="sib-form-placeholder-text" @@ -29,7 +30,7 @@ container.block_list.flex.flex_espace div#keyword_submit.button__actions div.button_base.ico_gauche Search - + sib-form#instance_database_only( data-src=`${endpoints.resources}`, fields='instance_database_only' @@ -38,30 +39,28 @@ container.block_list.flex.flex_espace naked ) - sib-form#more_criterias( data-src=`${endpoints.resources}`, - fields='header_criterias, format, publication_year, country, language.name, fields' - + fields='header_criterias, format, publication_year, country, language, fields' label-header_criterias='More criterias' label-format='Format:' label-publication_year='Year of publication' label-country='Country of publication' - label-language.name='Language' + label-language='Language' label-fields='Field' widget-header_criterias='cs-section_header' - range-language.name=`${endpoints.languages}` + range-language=`${endpoints.languages}` range-fields=`${endpoints.fields}` range-format=`${endpoints.formats}` - multiple-language.name='sib-multiple-select' - widget-language.name='sib-form-auto-completion' + multiple-language='sib-form-dropdown' + widget-language='sib-form-auto-completion' multiple-format='sib-form-dropdown' widget-format='sib-form-auto-completion' - multiple-fields='sib-multiple-select' + multiple-fields='sib-form-dropdown' widget-fields='sib-form-auto-completion' naked @@ -76,8 +75,12 @@ container.block_list.flex.flex_espace div div.button_base Make a request + div#resources-loader + hidden Loading resources, please wait... + //Step 1 sib-display#circles-list( + loader-id="resources-loader" data-src=`${endpoints.steps}1/`, fields='name' @@ -86,31 +89,45 @@ container.block_list.flex.flex_espace widget-name='cs-steps-header' ) - - sib-display#step1.resource_by_step( + + sib-display.resource_by_step( data-src=`${endpoints.steps}1/resources/`, - fields='name, author, format, publication_year, description, country, language.name, field', - search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language.name, field)', + fields='name, author, format, publication_year, description, country, language, fields', + search-fields='search_for_a_resource(name, description, author), 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-widget-search_for_a_resource="hidden-widget" search-widget-more_criterias_hidden="hidden-widget" - search-widget-format='sib-form-dropdown' + 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-name='cs-display-property' widget-country='cs-display-property' widget-publication_year='cs-display-property' widget-description='cs-display-property' - widget-field='cs-display-property' - widget-language.name="hidden-widget" + widget-fields='hidden-widget' + widget-language="hidden-widget" widget-author="cs-display-property" widget-format='cs-display-multiple-property' label-format='' multiple-format + label-language='' + multiple-language + label-fields='' + multiple-fields paginate-by="5" ) + //Step 2 sib-display#circles-list( data-src=`${endpoints.steps}2/`, fields='name' @@ -123,30 +140,42 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}2/resources/`, - fields='name, author, format, publication_year, description, country, language.name, field', - search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language.name, field)', - + fields='name, author, format, publication_year, description, country, language, fields', + search-fields='search_for_a_resource(name, description, author), 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-widget-search_for_a_resource="hidden-widget" search-widget-more_criterias_hidden="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-name='cs-display-property' widget-country='cs-display-property' widget-publication_year='cs-display-property' widget-description='cs-display-property' - widget-field='cs-display-property' - widget-language.name="hidden-widget" + widget-fields='hidden-widget' + widget-language="hidden-widget" widget-author="cs-display-property" widget-format='cs-display-multiple-property' label-format='' multiple-format - + label-language='' + multiple-language + label-fields='' + multiple-fields + paginate-by="5" ) + //Step 3 sib-display#circles-list( data-src=`${endpoints.steps}3/`, fields='name' @@ -160,30 +189,42 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}3/resources/`, - fields='name, author, format, publication_year, description, country, language.name, field', - search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language.name, field)', - + fields='name, author, format, publication_year, description, country, language, fields', + search-fields='search_for_a_resource(name, description, author), 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-widget-search_for_a_resource="hidden-widget" search-widget-more_criterias_hidden="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-name='cs-display-property' widget-country='cs-display-property' widget-publication_year='cs-display-property' widget-description='cs-display-property' - widget-field='cs-display-property' - widget-language.name="hidden-widget" + widget-fields='hidden-widget' + widget-language="hidden-widget" widget-author="cs-display-property" widget-format='cs-display-multiple-property' label-format='' multiple-format - + label-language='' + multiple-language + label-fields='' + multiple-fields + paginate-by="5" ) + //Step 4 sib-display#circles-list( data-src=`${endpoints.steps}4/`, fields='name' @@ -197,30 +238,42 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}4/resources/`, - fields='name, author, format, publication_year, description, country, language.name, field', - search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language.name, field)', - + fields='name, author, format, publication_year, description, country, language, fields', + search-fields='search_for_a_resource(name, description, author), 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-widget-search_for_a_resource="hidden-widget" search-widget-more_criterias_hidden="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-name='cs-display-property' widget-country='cs-display-property' widget-publication_year='cs-display-property' widget-description='cs-display-property' - widget-field='cs-display-property' - widget-language.name="hidden-widget" + widget-fields='hidden-widget' + widget-language="hidden-widget" widget-author="cs-display-property" widget-format='cs-display-multiple-property' label-format='' multiple-format - + label-language='' + multiple-language + label-fields='' + multiple-fields + paginate-by="5" ) + //Step 5 sib-display#circles-list( data-src=`${endpoints.steps}5/`, fields='name' @@ -233,56 +286,38 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}5/resources/`, - fields='name, author, format, publication_year, description, country, language.name, field', - search-fields='search_for_a_resource(name, description, author), more_criterias_hidden(format, publication_year, country, language.name, field)', - + fields='name, author, format, publication_year, description, country, language, fields', + search-fields='search_for_a_resource(name, description, author), 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-widget-search_for_a_resource="hidden-widget" search-widget-more_criterias_hidden="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-name='cs-display-property' widget-country='cs-display-property' widget-publication_year='cs-display-property' widget-description='cs-display-property' - widget-field='cs-display-property' - widget-language.name="hidden-widget" + widget-fields='hidden-widget' + widget-language="hidden-widget" widget-author="cs-display-property" widget-format='cs-display-multiple-property' label-format='' multiple-format - + label-language='' + multiple-language + label-fields='' + multiple-fields + paginate-by="5" ) - -//- 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' + diff --git a/src/includes/mentor/dashboard.pug b/src/includes/mentor/dashboard.pug index 89ed339e2dc34f09ccef2499aa86e20585e713ce..d27b1086ffc92656efe1fc7fdea92a04c4dbe13d 100644 --- a/src/includes/mentor/dashboard.pug +++ b/src/includes/mentor/dashboard.pug @@ -18,6 +18,7 @@ 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 @@ -26,6 +27,10 @@ section#home 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 @@ -46,5 +51,7 @@ section#home #mentor-account-edit(hidden).no-sidebar.container include profile/edit.pug + + diff --git a/src/includes/mentor/profile/edit.pug b/src/includes/mentor/profile/edit.pug index 36f2e6e8eb5f7ad9a2f2ae59e118cf08bad132c5..556b71bb9b3b16609624e8cd86a40edd56d34076 100644 --- a/src/includes/mentor/profile/edit.pug +++ b/src/includes/mentor/profile/edit.pug @@ -2,7 +2,7 @@ include ../../components/widgets h2.title_create Edit your account -sib-form.block_log.block_creat_count( +sib-form#mentor_profile_edition.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),\ @@ -59,4 +59,4 @@ sib-form.block_log.block_creat_count( submit-button="Save modifications" next='mentor-resource-list' -) \ 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 98488b194084c93325ce403a3a86be2cbf0c7599..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' diff --git a/src/includes/mentor/resources/detail.pug b/src/includes/mentor/resources/detail.pug index 03b72aa6a42ea6d03e57675dac557b93076557f6..51fb1d906baf8e4c252016d1b14c29c8200d0295 100644 --- a/src/includes/mentor/resources/detail.pug +++ b/src/includes/mentor/resources/detail.pug @@ -1,5 +1,13 @@ include ../../components/widgets +sib-router + sib-route( name='confirm_suppress', use-id) + +dialog#confirm_suppress + h1 confirm_suppress + sib-delete(data-label="Delete" bind-resources) + sib-link(class="backlink pull-right", next="mentor-resource-list") X + .block_log.block_creat_count.no_shadow sib-link(class="backlink", next="mentor-resource-list") .like @@ -115,5 +123,10 @@ include ../../components/widgets action-detail='mentor-resource-detail' ) + sib-link( + bind-resources, + next="confirm_suppress" + ) <i class="fas fa-trash-alt"></i> + \ 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 aef0b5ff23f1005613ff3ed0c522da8fb870ab5d..b5ce30fd3e6ea3b32dbb9d99b57b7df5df3b96bb 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -28,6 +28,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 => { @@ -36,7 +37,58 @@ function refreshList(formId, listId) { }); } +//Remove pagination when there is no resource in a step group +function refreshPagination() { + var resources_containers = document.querySelectorAll( + ".resource_by_step sib-form+div" + ); + for (let resources_container of resources_containers) { + if ( + resources_container.childElementCount < 5 || + resources_container.nextSibling.querySelector("nav span span+span") + .textContent == 1 + ) { + resources_container.nextSibling.setAttribute("style", "display:none"); + } else { + resources_container.nextSibling.setAttribute("style", "display:block"); + } + } +} + +//Manage select hidden to fullfill them with more "more criterias" selection +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($) { + //Refresh pagination + refreshPagination(); + // Get the element with id="defaultOpen" and click on it document.getElementById("defaultOpen").click(); @@ -54,6 +106,11 @@ jQuery(document).ready(function($) { refreshList("mentor_profile_creation", "mentor_info"); refreshList("mentor_profile_creation", "mentor_complementary"); refreshList("mentor_profile_creation", "mentor_contact"); + refreshList("entrepreneur_profile_edition", "entrepreneur_info"); + refreshList("entrepreneur_profile_edition", "entrepreneur_contact"); + refreshList("mentor_profile_edition", "mentor_info"); + refreshList("mentor_profile_edition", "mentor_complementary"); + refreshList("mentor_profile_edition", "mentor_contact"); const logoutButtons = document.getElementsByClassName("logout-button"); for (var i = 0; i < logoutButtons.length; i++) { @@ -76,6 +133,8 @@ jQuery(document).ready(function($) { forms.forEach(form => { form.addEventListener("populate", e => { + //On load in dashbord Entrepreneur + refreshPagination(); //SEARCH BY KEYWORD //To retrieve keyword //https://git.happy-dev.fr/startinblox/framework/sib-core/issues/379 @@ -92,6 +151,8 @@ jQuery(document).ready(function($) { keyword_hidden_fields.forEach(hidden_field => { hidden_field.setAttribute("value", keyword_field.value); form.querySelector("sib-form").component.inputChange(); + refreshPagination(); + }); }); @@ -112,6 +173,31 @@ jQuery(document).ready(function($) { // https://git.happy-dev.fr/startinblox/framework/sib-core/issues/453 window.setTimeout(() => { + //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 @@ -122,52 +208,50 @@ jQuery(document).ready(function($) { 'hidden-widget[name="more_criterias_hidden"] select[name="format"]' ); - - //TODO: Every time the format field in the search form changes - //Iterate through all 5 filters form associated with the sib-displays - //Iterate through their inputs to get the format one - //Change the value and the selected option of this field - //Reload the component to trigger the filter + //TODO: The first time the event is not call. format_field_search.onchange = function() { let option_selected = format_field_search.querySelector( "option:checked" ); 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(); - } + selectHiddenManagement(select_hidden, option_selected, form); }); }; //To retrieve language - //TODO: How we should filled the hidden field? let language_field_search = more_criterias_form.querySelector( - `select[name="language.name"]` + `select[name="language"]` ); - language_hidden_fields = document.querySelectorAll( - 'hidden-widget[name="more_criterias_hidden"] input[name="language.name"]' + language_hidden_field = document.querySelectorAll( + 'hidden-widget[name="more_criterias_hidden"] select[name="language"]' ); language_field_search.onchange = function() { - language_hidden_fields.forEach(language_field => { - language_field.setAttribute( - "value", - language_field_search.options[language_field_search.selectedIndex] - .text - ); - form.querySelector("sib-form").component.inputChange(); + let option_selected = language_field_search.querySelector( + "option:checked" + ); + + language_hidden_field.forEach(function(select_hidden) { + selectHiddenManagement(select_hidden, option_selected, form); + }); + }; + + //To retrieve field + let field_field_search = more_criterias_form.querySelector( + `select[name="fields"]` + ); + let field_hidden_field = document.querySelectorAll( + 'hidden-widget[name="more_criterias_hidden"] select[name="fields"]' + ); + + field_field_search.onchange = function() { + let option_selected = field_field_search.querySelector( + "option:checked" + ); + + field_hidden_field.forEach(function(select_hidden) { + selectHiddenManagement(select_hidden, option_selected, form); }); }; @@ -182,9 +266,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); - form.querySelector("sib-form").component.inputChange(); + year_hidden_fields.forEach(field => { + inputHiddenManagement(field, year_field_search, form); }); }); @@ -197,9 +280,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); - 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%; }