diff --git a/src/includes/components/widgets.pug b/src/includes/components/widgets.pug index e25d7aa03d7b4ce78fc1a26fb3bc038c9f6b84ae..c14c33f221127d8b3cc908c2566aadd4ae47a621 100644 --- a/src/includes/components/widgets.pug +++ b/src/includes/components/widgets.pug @@ -109,6 +109,14 @@ sib-widget(name='cs-broken-action') data-src="\${src}" next="\${value}" ) <i class="fas fa-heart-broken"></i> ${label} + +sib-widget(name='cs-request-status-action') + template + div + sib-link.button_base.pull-right( + data-src="\${src}" + next="confirm_status_change" + ) ${label} sib-widget(name='cs-section_introduction') template diff --git a/src/includes/entrepreneur/resources/list.pug b/src/includes/entrepreneur/resources/list.pug index 997edd9f7dc9a5ff074c58e691d52a8763d7c6e9..55cf9245bf94fed89141509ca1de121fd9cb4727 100644 --- a/src/includes/entrepreneur/resources/list.pug +++ b/src/includes/entrepreneur/resources/list.pug @@ -121,18 +121,16 @@ container.block_list.flex.flex_espace ) sib-display.resource_by_step( - loader-id="step1-loader" data-src=`${endpoints.steps}1/resources/validated/`, - fields='name, format.name, publication_year, description, like, dislike', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` search-range-fields=`${endpoints.fields}` search-range-type=`${endpoints.types}` - - - search-widget-search_for_a_resource="hidden-widget" + search-widget-more_criterias_hidden="hidden-widget" + search-widget-search_for_a_resource="hidden-widget" search-multiple-type='sib-form-dropdown' search-widget-type='sib-form-auto-completion' search-multiple-format='sib-form-dropdown' @@ -144,7 +142,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -180,16 +178,15 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}2/resources/validated/`, - fields='name, format.name, publication_year, description, like, dislike', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` search-range-fields=`${endpoints.fields}` search-range-type=`${endpoints.types}` - - - search-widget-search_for_a_resource="hidden-widget" + search-widget-more_criterias_hidden="hidden-widget" + search-widget-search_for_a_resource="hidden-widget" search-multiple-type='sib-form-dropdown' search-widget-type='sib-form-auto-completion' search-multiple-format='sib-form-dropdown' @@ -201,7 +198,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -237,16 +234,15 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}3/resources/validated/`, - fields='name, format.name, publication_year, description, like, dislike', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` search-range-fields=`${endpoints.fields}` search-range-type=`${endpoints.types}` - - - search-widget-search_for_a_resource="hidden-widget" + search-widget-more_criterias_hidden="hidden-widget" + search-widget-search_for_a_resource="hidden-widget" search-multiple-type='sib-form-dropdown' search-widget-type='sib-form-auto-completion' search-multiple-format='sib-form-dropdown' @@ -257,7 +253,7 @@ container.block_list.flex.flex_espace search-widget-fields='sib-form-auto-completion' widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -293,16 +289,15 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}4/resources/validated/`, - fields='name, format.name, publication_year, description, like, dislike', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` search-range-fields=`${endpoints.fields}` search-range-type=`${endpoints.types}` - - - search-widget-search_for_a_resource="hidden-widget" + search-widget-more_criterias_hidden="hidden-widget" + search-widget-search_for_a_resource="hidden-widget" search-multiple-type='sib-form-dropdown' search-widget-type='sib-form-auto-completion' search-multiple-format='sib-form-dropdown' @@ -314,7 +309,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -349,16 +344,15 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}5/resources/validated/`, - fields='name, format.name, publication_year, description, like, dislike', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` search-range-fields=`${endpoints.fields}` search-range-type=`${endpoints.types}` - - - search-widget-search_for_a_resource="hidden-widget" + search-widget-more_criterias_hidden="hidden-widget" + search-widget-search_for_a_resource="hidden-widget" search-multiple-type='sib-form-dropdown' search-widget-type='sib-form-auto-completion' search-multiple-format='sib-form-dropdown' @@ -370,7 +364,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -405,16 +399,15 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}6/resources/validated/`, - fields='name, format.name, publication_year, description, like, dislike', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` search-range-fields=`${endpoints.fields}` search-range-type=`${endpoints.types}` - - - search-widget-search_for_a_resource="hidden-widget" + search-widget-more_criterias_hidden="hidden-widget" + search-widget-search_for_a_resource="hidden-widget" search-multiple-type='sib-form-dropdown' search-widget-type='sib-form-auto-completion' search-multiple-format='sib-form-dropdown' @@ -426,7 +419,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' diff --git a/src/includes/mentor/browseDatabase.pug b/src/includes/mentor/browseDatabase.pug index da53014c24da614e859cba1ccc08a32948f4c8c3..e2f32bf9e94a521b70fd7007a8040e05206f8ada 100644 --- a/src/includes/mentor/browseDatabase.pug +++ b/src/includes/mentor/browseDatabase.pug @@ -28,7 +28,7 @@ container.block_list.flex.flex_espace sib-form.search-by-keyword( data-src=`${endpoints.resources}`, loader-id="resources-mentor-database-loader" - fields='keyword(name_keyword)' + fields='keyword(name_keyword)' label-name_keyword="Search by name..." widget-name_keyword="sib-form-placeholder-text" @@ -98,8 +98,11 @@ container.block_list.flex.flex_espace //Step 1 div.step + div#resources-loader-step1-browse-database + hidden + i.fas.fa-spinner.fa-spin sib-display#circles-list( - loader-id="resources-loader" + loader-id="resources-loader-step1-browse-database" data-src=`${endpoints.steps}1/`, fields='name' class="accordion active" @@ -112,16 +115,15 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}1/resources/validated/`, - fields='name, author, format.name, publication_year, description, country, language, fields', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` search-range-fields=`${endpoints.fields}` search-range-type=`${endpoints.types}` - - - search-widget-search_for_a_resource="hidden-widget" + search-widget-more_criterias_hidden="hidden-widget" + search-widget-search_for_a_resource="hidden-widget" search-multiple-type='sib-form-dropdown' search-widget-type='sib-form-auto-completion' search-multiple-format='sib-form-dropdown' @@ -133,7 +135,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -167,16 +169,15 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}2/resources/validated/`, - fields='name, author, format.name, publication_year, description, country, language, fields', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` search-range-fields=`${endpoints.fields}` search-range-type=`${endpoints.types}` - - - search-widget-search_for_a_resource="hidden-widget" + search-widget-more_criterias_hidden="hidden-widget" + search-widget-search_for_a_resource="hidden-widget" search-multiple-type='sib-form-dropdown' search-widget-type='sib-form-auto-completion' search-multiple-format='sib-form-dropdown' @@ -188,7 +189,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -223,16 +224,15 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}3/resources/validated/`, - fields='name, author, format.name, publication_year, description, country, language, fields', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` search-range-fields=`${endpoints.fields}` search-range-type=`${endpoints.types}` - - - search-widget-search_for_a_resource="hidden-widget" + search-widget-more_criterias_hidden="hidden-widget" + search-widget-search_for_a_resource="hidden-widget" search-multiple-type='sib-form-dropdown' search-widget-type='sib-form-auto-completion' search-multiple-format='sib-form-dropdown' @@ -244,7 +244,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -279,16 +279,15 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}4/resources/validated/`, - fields='name, author, format.name, publication_year, description, country, language, fields', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` search-range-fields=`${endpoints.fields}` search-range-type=`${endpoints.types}` - - - search-widget-search_for_a_resource="hidden-widget" + search-widget-more_criterias_hidden="hidden-widget" + search-widget-search_for_a_resource="hidden-widget" search-multiple-type='sib-form-dropdown' search-widget-type='sib-form-auto-completion' search-multiple-format='sib-form-dropdown' @@ -300,7 +299,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -334,16 +333,15 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}5/resources/validated/`, - fields='name, author, format.name, publication_year, description, country, language, fields', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` search-range-fields=`${endpoints.fields}` search-range-type=`${endpoints.types}` - - - search-widget-search_for_a_resource="hidden-widget" + search-widget-more_criterias_hidden="hidden-widget" + search-widget-search_for_a_resource="hidden-widget" search-multiple-type='sib-form-dropdown' search-widget-type='sib-form-auto-completion' search-multiple-format='sib-form-dropdown' @@ -355,7 +353,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -389,16 +387,15 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}6/resources/validated/`, - fields='name, format.name, publication_year, description, like, dislike', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` search-range-fields=`${endpoints.fields}` search-range-type=`${endpoints.types}` - - - search-widget-search_for_a_resource="hidden-widget" + search-widget-more_criterias_hidden="hidden-widget" + search-widget-search_for_a_resource="hidden-widget" search-multiple-type='sib-form-dropdown' search-widget-type='sib-form-auto-completion' search-multiple-format='sib-form-dropdown' @@ -410,7 +407,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' diff --git a/src/includes/mentor/profile/edit.pug b/src/includes/mentor/profile/edit.pug index c758091c3d4aa339cf511426c51cd48146c4c379..198a850a3b35ce05fb54806682eb33c30e7e4f1a 100644 --- a/src/includes/mentor/profile/edit.pug +++ b/src/includes/mentor/profile/edit.pug @@ -7,7 +7,7 @@ sib-form#mentor_profile_edition.block_log.block_creat_count( 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),\ + mentor_profile.biography, mentor_profile.skills, resources),\ social_media(header_social_media, mentor_profile.linkedin, mentor_profile.twitter), username" range-mentor_profile.fields=`${endpoints.fields}` @@ -39,6 +39,7 @@ sib-form#mentor_profile_edition.block_log.block_creat_count( widget-mentor_profile.skills="sib-form-textarea" widget-mentor_profile.biography="sib-form-textarea" widget-username="sib-form-hidden" + widget-resources="hidden-widget" class-mentor_profile.organisation='form-label is-dark' widget-mentor_profile.organisation='sib-form-auto-completion' diff --git a/src/includes/mentor/resources/confirmation-status-change.pug b/src/includes/mentor/resources/confirmation-status-change.pug new file mode 100644 index 0000000000000000000000000000000000000000..b4c9ebf06122c05352820691b5e69dd620cdb683 --- /dev/null +++ b/src/includes/mentor/resources/confirmation-status-change.pug @@ -0,0 +1,18 @@ +include ../../components/widgets + +.block_log.block_creat_count.no_shadow + sib-link(class="backlink", next="mentor-resource-list") + .like + p + i.fas.fa-times + + h2.title_lead_avenir Are you sur you want to archive this request ? + + sib-form#change_status_request( + bind-resources + fields='button(status, name, description, skills, reviewer)' + value-status = "validated" + widget-button = "hidden-widget" + submit-button = "Archive this request" + next="mentor-resource-list" + ) diff --git a/src/includes/mentor/resources/list.pug b/src/includes/mentor/resources/list.pug index 5f26ee41694c9e54c84f6fc0402e51229183179c..75c19e5897329875fb2089ff2eb8288db5653dc6 100644 --- a/src/includes/mentor/resources/list.pug +++ b/src/includes/mentor/resources/list.pug @@ -3,6 +3,7 @@ include ../../components/widgets sib-router sib-route( name='confirm_suppress', use-id) sib-route( name='resource-report-broken-link-mentor', use-id) + sib-route( name='confirm_status_change', id-prefix=`${endpoints.requests}`, use-id) dialog#confirm_suppress.no-sidebar include ./confirmation-deletion @@ -10,6 +11,9 @@ dialog#confirm_suppress.no-sidebar dialog#resource-report-broken-link-mentor include ./resource-report-broken-link-mentor +dialog#confirm_status_change.no-sidebar + include ./confirmation-status-change + 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 @@ -62,11 +66,11 @@ div.block_list div#loader-requests-mentor hidden i.fas.fa-spinner.fa-spin - sib-display.request_accordion( + sib-display#request-list.request_accordion( loader-id="loader-requests-mentor" data-src=`${endpoints.requests}` - fields='name, content(description, info(fields, language.name, target, submitter.email), create)', - + fields='name, content(description, info(fields, language.name, target, submitter.email, status))', + search-fields='status' label-target='Target audience:' label-language.name='Language:' label-submitter.email="submitter'email :" @@ -78,10 +82,13 @@ div.block_list widget-target='cs-display-resource-property' widget-submitter.email='cs-display-resource-property' widget-name='accordion-request-resource' + search-widget-status='hidden-widget' + search-value-status='pending' + + label-status='Dealt with' + widget-status='cs-request-status-action' + action-status="status" - label-create='Post a resource' - action-create="mentor-resource-create" - widget-create='cs-validate-action' ) diff --git a/src/includes/public/resources/list.pug b/src/includes/public/resources/list.pug index f6d0cdef6326fecfaaf2dc8a8e351500fe00310b..ba13d1bf44e1cbf505687fad7e1ffdef21b35cdc 100644 --- a/src/includes/public/resources/list.pug +++ b/src/includes/public/resources/list.pug @@ -90,7 +90,11 @@ container.block_list.flex.flex_espace //Step 1 div.step + div#resources-loader-step1-public + hidden + i.fas.fa-spinner.fa-spin sib-display#circles-list( + loader-id="resources-loader-step1-public" data-src=`${endpoints.steps}1/`, fields='name' class="accordion active" @@ -103,7 +107,7 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}1/resources/validated/`, - fields='name, author, format.name, publication_year, description, country, language, fields', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` @@ -123,7 +127,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -159,7 +163,7 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}2/resources/validated/`, - fields='name, author, format.name, publication_year, description, country, language, fields', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` @@ -179,7 +183,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -216,7 +220,7 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}3/resources/validated/`, - fields='name, author, format.name, publication_year, description, country, language, fields', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` @@ -236,7 +240,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -272,7 +276,7 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}4/resources/validated/`, - fields='name, author, format.name, publication_year, description, country, language, fields', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` @@ -292,7 +296,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -328,7 +332,7 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}5/resources/validated/`, - fields='name, author, format.name, publication_year, description, country, language, fields', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` @@ -348,7 +352,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -383,16 +387,15 @@ container.block_list.flex.flex_espace sib-display.resource_by_step( data-src=`${endpoints.steps}6/resources/validated/`, - fields='name, format.name, publication_year, description, like, dislike', + fields='name, author, format.name, publication_year, description, like, dislike, country, language, fields', search-fields='search_for_a_resource(name), more_criterias_hidden(format, publication_year, country, language, fields, type)', search-range-format=`${endpoints.formats}` search-range-language=`${endpoints.languages}` search-range-fields=`${endpoints.fields}` search-range-type=`${endpoints.types}` - - - search-widget-search_for_a_resource="hidden-widget" + search-widget-more_criterias_hidden="hidden-widget" + search-widget-search_for_a_resource="hidden-widget" search-multiple-type='sib-form-dropdown' search-widget-type='sib-form-auto-completion' search-multiple-format='sib-form-dropdown' @@ -404,7 +407,7 @@ container.block_list.flex.flex_espace widget-name='cs-display-property' - widget-country='cs-display-property' + widget-country='hidden-widget' widget-publication_year='cs-display-property' widget-description='cs-display-property' widget-fields='hidden-widget' @@ -419,7 +422,8 @@ container.block_list.flex.flex_espace label-fields='' multiple-fields class="panel" - next='entrepreneur-resource-detail' + + next='public-resource-detail' paginate-by="5" ) diff --git a/src/index.pug b/src/index.pug index 97b326b592cdd829cecca836c67c617cc06b0c98..20604cd66059d2a1260247cafb7a3a7d153d64af 100644 --- a/src/index.pug +++ b/src/index.pug @@ -51,7 +51,9 @@ script(type='module'). let idToken = await sibAuth.getUserIdToken(); if ( !user ) { - return; + window.dispatchEvent( + new CustomEvent('requestNavigation', { detail: { route: 'splash' } }) + ); } user = await store.get(user); diff --git a/src/scripts/coopstarter.js b/src/scripts/coopstarter.js index 9499f0624f70f1691a21e739333d7dc4870dfcd0..15618f3af9a60051a94c4806dd2a09abe626757f 100644 --- a/src/scripts/coopstarter.js +++ b/src/scripts/coopstarter.js @@ -1,3 +1,8 @@ +/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXX FUNCTIONS XXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/ + function openTab(pageName, elmnt) { // Hide all elements with class="tabcontent" by default */ var i, tabcontent, tablinks; @@ -14,6 +19,7 @@ function openTab(pageName, elmnt) { elmnt.classList.add("active"); } + //Manage the visual of the fake tabs in entrepreneur dashboard. function openFakeTab(elmnt) { // Hide all elements with class="tabcontent" by default */ @@ -26,6 +32,7 @@ function openFakeTab(elmnt) { elmnt.classList.add("active"); } + function loadFile(event) { var elt = document.createElement("img"); elt.src = URL.createObjectURL(event.target.files[0]); @@ -41,6 +48,7 @@ function loadFile(event) { labeltag.insertAdjacentElement("afterbegin", elt); } + function linkDatasetToField(detail, targetFormName, inputName) { let targetForm = document.getElementById(targetFormName); targetForm.addEventListener("populate", event => { @@ -55,6 +63,7 @@ function linkDatasetToField(detail, targetFormName, inputName) { }); } + //Refresh information after a form submission function refreshList(formId, listId) { let form = document.getElementById(formId); @@ -64,6 +73,7 @@ function refreshList(formId, listId) { }); } + //Remove pagination when there is no resource in a step group function refreshPagination() { var resources_containers = document.querySelectorAll( @@ -78,8 +88,8 @@ function refreshPagination() { .textContent == 1) ) { resources_container.nextSibling.setAttribute("style", "display:none"); - } else if (resources_container.nextSibling) { - resources_container.nextSibling.setAttribute("style", "display:block"); + } else if (resources_container.nextSibling && resources_container.closest(".step").querySelector('.accordion:not(.active)')) { + resources_container.nextSibling.setAttribute("hidden", "hidden"); } } } @@ -145,15 +155,86 @@ function selectHiddenManagementForType(tab, form) { //Manage the report broken links hidden form function fillReportBrokenLinkForm(event, userWhoSubmitReport, formBrokenLink) { - formBrokenLink.querySelector( "input[name='resource']" ).value = JSON.stringify({ "@id": event.target.dataset.src }); + formBrokenLink.querySelector( "input[name='submitter']" ).value = JSON.stringify({ "@id": userWhoSubmitReport }); } +//Manage the accordion for step in entrepreneur dashboard +function manageAccordionByStep(){ + var acc = document.getElementsByClassName("accordion"); + var i; + + for (i = 0; i < acc.length; i++) { + acc[i].addEventListener("click", function() { + if (this.classList.contains("active") == true){ + this.classList.remove("active") + this.nextElementSibling.querySelector("sib-form + div").style.maxHeight = "0px"; + }else{ + this.classList.add("active") + } + + this.closest(".step").querySelector('nav').removeAttribute("hidden"); + refreshPagination() + + var panel = this.nextElementSibling.querySelector("sib-form + div"); + + if (panel.style.maxHeight) { + panel.style.maxHeight = null; + } else { + panel.style.maxHeight = panel.scrollHeight + "px"; + } + + }); + } +} + +//Manage the accordion for requested resources in the mentor dashboard +function manageAccordionForRequest(){ + var accRequest = document.querySelectorAll( + "#requests accordion-request-resource" + ); + + for (let i = 0; i < accRequest.length; i++) { + accRequest[i].addEventListener("click", function() { + /* Toggle between adding and removing the "active" class, + to highlight the button that controls the panel */ + this.classList.toggle("active"); + + /* Toggle between hiding and showing the active panel */ + var panelRequest = this.nextElementSibling; + if (!this.classList.contains("active")) { + panelRequest.style.maxHeight = null; + refreshPagination(); + } else { + panelRequest.style.maxHeight = panelRequest.scrollHeight + "px"; + } + }); + } +} + +//Manage the action of the logout button +function manageLogoutButton(){ + 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); + }); + } +} + function addProperFilterToSearchComponents(targetId) { var baseElement = document.getElementById(targetId); var forms = baseElement.querySelectorAll(".resource_by_step"); @@ -182,14 +263,23 @@ function addProperFilterToSearchComponents(targetId) { 'hidden-widget[name="search_for_a_resource"] input' ); - keyword_submit.addEventListener("click", function() { - keyword_hidden_fields.forEach(hidden_field => { - hidden_field.setAttribute("value", keyword_field.value); - let parent_form = hidden_field.closest("sib-form"); - parent_form.component.inputChange(); - refreshPagination(); + if (keyword_field) { + let keyword_submit = baseElement.querySelectorAll(" .keyword_submit")[0]; + let keyword_hidden_fields = baseElement.querySelectorAll( + 'hidden-widget[name="search_for_a_resource"] input' + ); + + keyword_submit.addEventListener("click", function() { + keyword_hidden_fields.forEach(hidden_field => { + hidden_field.setAttribute("value", keyword_field.value); + hidden_field.value = keyword_field.value; + + let parent_form = hidden_field.closest("sib-form"); + parent_form.component.inputChange(); + refreshPagination(); + }); }); - }); + } //SEARCH IN DATABASE INSTANCE ONLY let instance_only = baseElement.querySelectorAll( @@ -215,12 +305,9 @@ function addProperFilterToSearchComponents(targetId) { //Manage fake tabs for type let tabs = baseElement.getElementsByClassName("filter_by_type"); for (let tab of tabs) { - tab.addEventListener( - "click", - function() { - selectHiddenManagementForType(tab, form) - } - ); + tab.addEventListener("click", function() { + selectHiddenManagementForType(tab, form); + }); } //To retrieve format @@ -321,7 +408,10 @@ function addProperFilterToSearchComponents(targetId) { }); }); } - +/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXX ON LOAD XXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/ jQuery(document).ready(function($) { //Refresh pagination refreshPagination(); @@ -333,6 +423,7 @@ jQuery(document).ready(function($) { linkDatasetToField(userAccountDataSrc, "validation-form", "reviewer"); linkDatasetToField(userAccountDataSrc, "improvement-dialog-form", "reviewer"); linkDatasetToField(userAccountDataSrc, "refusal-dialog-form", "reviewer"); + linkDatasetToField(userAccountDataSrc, "change_status_request", "reviewer"); refreshList("resource-creation-form", "resources-history"); refreshList("validation-form", "pending-resources"); @@ -352,6 +443,7 @@ jQuery(document).ready(function($) { refreshList("mentor_profile_edition", "mentor_complementary"); refreshList("mentor_profile_edition", "mentor_contact"); refreshList("mentor_profile_edition", "user-account-picture"); + refreshList("change_status_request", "request-list"); var header_dropdown = $(".dropdownWrapper"), drop_choices = header_dropdown.find(".dropdownLabel"); @@ -369,22 +461,12 @@ jQuery(document).ready(function($) { } //Manage the logout action - 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); - }); - } + manageLogoutButton() - //MENTOR DASHBOARD************************************************************* +/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXX MENTOR DASHBOARD XXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/ window.setTimeout(() => { //Manage the form to report broken link. let detailsMentor = document.getElementById("detail-mentor"); @@ -394,72 +476,44 @@ jQuery(document).ready(function($) { fillReportBrokenLinkForm(event, userWhoSubmitReport, formBrokenLink); }); - var forms = document.querySelectorAll("sib-form"); - forms.forEach(form => { - form.addEventListener("populate", e => { - 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); - } - }); - - //Manage the accordion in request mentor dashboard. - var accRequest = document.querySelectorAll( - "#requests accordion-request-resource" - ); - - for (let i = 0; i < accRequest.length; i++) { - accRequest[i].addEventListener("click", function() { - /* Toggle between adding and removing the "active" class, - to highlight the button that controls the panel */ - this.classList.toggle("active"); - - /* Toggle between hiding and showing the active panel */ - var panelRequest = this.nextElementSibling; - if (panelRequest.style.maxHeight) { - panelRequest.style.maxHeight = null; - } else { - panelRequest.style.maxHeight = panelRequest.scrollHeight + "px"; - } - }); - } - - //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" } - }) - ); - }); - } - }); - }, 2000); + 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"; + } - //ENTREPRENEUR DASHBOARD************************************************************* + for (let item of previewImage) { + item.addEventListener("change", loadFile); + } - window.setTimeout(() => { + //Manage the accordion in request mentor dashboard. + manageAccordionForRequest() + + //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" } + }) + ); + }); + }; + //Manage the form to report broken link. let detailsEntrepreneur = document.getElementById("detail-entrepreneur"); detailsEntrepreneur.addEventListener("populate", event => { @@ -468,23 +522,18 @@ jQuery(document).ready(function($) { fillReportBrokenLinkForm(event, userWhoSubmitReport, formBrokenLink); }); - //Accordion by step - var acc = document.getElementsByClassName("accordion"); - var i; + }, 3000); - for (i = 0; i < acc.length; i++) { - acc[i].addEventListener("click", function() { - this.classList.toggle("active"); +/* XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXX ENTREPRENEUR DASHBOARD XXXXXXXXXXXXXXXXXXXX +XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/ - var panel = this.nextElementSibling.querySelector("sib-form + div"); + window.setTimeout(() => { + //Manage accordion by step + manageAccordionByStep() + refreshPagination() - if (panel.style.maxHeight) { - panel.style.maxHeight = null; - } else { - panel.style.maxHeight = panel.scrollHeight + "px"; - } - }); - } }, 2000); //In the entrepreneur dashboard, we set data from the display form to the hidden ones. diff --git a/src/styles/index.scss b/src/styles/index.scss index 562fca4e965af1baa21efda316fd092117f6fe1e..665ec505d677955d8eccdd35835c106315bb59fa 100644 --- a/src/styles/index.scss +++ b/src/styles/index.scss @@ -1266,7 +1266,7 @@ sib-set-default[name="submitter_info"]{ } } /* XXXXXXXXXXXXXXXXXXXXXXXXX Modal XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX*/ -#confirm_suppress, #resource-validation-process, +#confirm_suppress, #confirm_status_change, #resource-validation-process, #resource-validation-process-confirmation { border: none; top: 0;