diff --git a/app/controllers/users/commencer_controller.rb b/app/controllers/users/commencer_controller.rb index 63e7dacdd..d70f5facd 100644 --- a/app/controllers/users/commencer_controller.rb +++ b/app/controllers/users/commencer_controller.rb @@ -1,6 +1,6 @@ module Users class CommencerController < ApplicationController - layout 'procedure_context' + layout 'procedure_context_full_screen' def commencer @procedure = retrieve_procedure diff --git a/app/controllers/users/dossiers_controller.rb b/app/controllers/users/dossiers_controller.rb index 8f396dad3..5068478ea 100644 --- a/app/controllers/users/dossiers_controller.rb +++ b/app/controllers/users/dossiers_controller.rb @@ -92,12 +92,10 @@ module Users def identite @dossier = dossier @user = current_user - @hide_description = true end def update_identite @dossier = dossier - @hide_description = true if @dossier.individual.update(individual_params) @dossier.update!(autorisation_donnees: true, identity_updated_at: Time.zone.now) @@ -112,12 +110,10 @@ module Users def siret @dossier = dossier - @hide_description = true end def update_siret @dossier = dossier - @hide_description = true # We use the user as the holder model object for the siret value # (so that we can restore it on the form in case of error). diff --git a/app/views/administrateurs/procedures/_informations.html.haml b/app/views/administrateurs/procedures/_informations.html.haml index d451f421e..e15874281 100644 --- a/app/views/administrateurs/procedures/_informations.html.haml +++ b/app/views/administrateurs/procedures/_informations.html.haml @@ -6,7 +6,7 @@ = f.label :libelle do Titre de la démarche %span.mandatory * -= f.text_field :libelle, class: 'form-control', placeholder: 'Titre' += f.text_field :libelle, class: 'form-control', placeholder: 'Titre', required: true = f.label :description_what do Quel est l’objet de la démarche ? diff --git a/app/views/administrateurs/procedures/edit.html.haml b/app/views/administrateurs/procedures/edit.html.haml index 7571094af..1e1b66792 100644 --- a/app/views/administrateurs/procedures/edit.html.haml +++ b/app/views/administrateurs/procedures/edit.html.haml @@ -25,4 +25,4 @@ .procedure-form__preview.sticky--top %h3.procedure-form__preview-title Aperçu .procedure-preview - = render partial: 'shared/procedure_description', locals: { procedure: @procedure } + = render partial: 'shared/procedure_description', locals: { procedure: @procedure, full_screen_display: false } diff --git a/app/views/administrateurs/procedures/new.html.haml b/app/views/administrateurs/procedures/new.html.haml index 99b375169..aae964bc0 100644 --- a/app/views/administrateurs/procedures/new.html.haml +++ b/app/views/administrateurs/procedures/new.html.haml @@ -25,4 +25,4 @@ .procedure-form__preview.sticky--top %h3.procedure-form__preview-title Aperçu .procedure-preview - = render partial: 'shared/procedure_description', locals: { procedure: @procedure } + = render partial: 'shared/procedure_description', locals: { procedure: @procedure, full_screen_display: false } diff --git a/app/views/commencer/show.html.haml b/app/views/commencer/show.html.haml index 4bf80acdb..1cae0d8d3 100644 --- a/app/views/commencer/show.html.haml +++ b/app/views/commencer/show.html.haml @@ -2,7 +2,7 @@ .commencer.form - if !user_signed_in? - = render Dsfr::CalloutComponent.new(title: t("views.commencer.show.start_procedure")) do |c| + = render Dsfr::CalloutComponent.new(title: t("views.commencer.show.start_procedure"), heading_level: 'h2') do |c| - c.body do = render partial: 'shared/france_connect_login', locals: { url: commencer_france_connect_path(path: @procedure.path, prefill_token: @prefilled_dossier&.prefill_token) } = link_to commencer_sign_up_path(path: @procedure.path, prefill_token: @prefilled_dossier&.prefill_token), class: 'fr-btn fr-mb-2w fr-mr-2w' do @@ -18,7 +18,7 @@ - not_drafts = dossiers.merge(Dossier.state_not_brouillon) - if @prefilled_dossier - = render Dsfr::CalloutComponent.new(title: t("views.commencer.show.prefilled_draft")) do |c| + = render Dsfr::CalloutComponent.new(title: t("views.commencer.show.prefilled_draft"), heading_level: 'h2') do |c| - c.body do %p= t('views.commencer.show.prefilled_draft_detail_html', time_ago: time_ago_in_words(@prefilled_dossier.created_at), procedure: @procedure.libelle) = link_to t('views.commencer.show.go_to_prefilled_file'), url_for_dossier(@prefilled_dossier), class: 'fr-btn fr-mb-2w' @@ -28,7 +28,7 @@ - elsif drafts.size == 1 && not_drafts.empty? - dossier = drafts.first - = render Dsfr::CalloutComponent.new(title: t("views.commencer.show.already_draft")) do |c| + = render Dsfr::CalloutComponent.new(title: t("views.commencer.show.already_draft"), heading_level: 'h2') do |c| - c.body do %p = t('views.commencer.show.already_draft_detail_html', time_ago: time_ago_in_words(dossier.created_at), procedure: dossier.procedure.libelle) @@ -37,7 +37,7 @@ - elsif not_drafts.size == 1 - dossier = not_drafts.first - = render Dsfr::CalloutComponent.new(title: t("views.commencer.show.already_not_draft")) do |c| + = render Dsfr::CalloutComponent.new(title: t("views.commencer.show.already_not_draft"), heading_level: 'h2') do |c| - c.body do %p = t('views.commencer.show.already_not_draft_detail_html', time_ago: time_ago_in_words(dossier.depose_at), procedure: dossier.procedure.libelle) @@ -45,7 +45,7 @@ = link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: 'fr-btn fr-btn--secondary fr-mb-2w' - else - = render Dsfr::CalloutComponent.new(title: t("views.commencer.show.existing_dossiers")) do |c| + = render Dsfr::CalloutComponent.new(title: t("views.commencer.show.existing_dossiers"), heading_level: 'h2') do |c| - c.body do = link_to t('views.commencer.show.show_dossiers'), dossiers_path, class: "fr-btn fr-mb-2w" = link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: "fr-btn fr-btn--secondary fr-mb-2w" diff --git a/app/views/layouts/procedure_context.html.haml b/app/views/layouts/procedure_context.html.haml index 74b6bc0d8..474828a85 100644 --- a/app/views/layouts/procedure_context.html.haml +++ b/app/views/layouts/procedure_context.html.haml @@ -1,15 +1,17 @@ - procedure = @procedure || @dossier&.procedure || nil - content_for :content do - .fr-container.fr-mt-5w - .fr-grid-row - .fr-col-12.fr-col-md-8.fr-col-offset-md-2 - .procedure-preview.fr-mb-5w - - if procedure - = render partial: 'shared/procedure_description', locals: { procedure: procedure } - - else - = render partial: 'layouts/commencer/no_procedure' - = yield + .two-columns.procedure-context + .columns-container + + .column.procedure-preview + - if procedure + = render partial: 'shared/procedure_description', locals: { procedure: procedure, full_screen_display: false } + - else + = render partial: 'layouts/commencer/no_procedure' + + .column.procedure-context-content + = yield - content_for :footer do - if procedure diff --git a/app/views/layouts/procedure_context_full_screen.html.haml b/app/views/layouts/procedure_context_full_screen.html.haml new file mode 100644 index 000000000..f7f2b36fb --- /dev/null +++ b/app/views/layouts/procedure_context_full_screen.html.haml @@ -0,0 +1,20 @@ +- procedure = @procedure || @dossier&.procedure || nil + +- content_for :content do + .fr-container.fr-mt-5w + .fr-grid-row + .fr-col-12.fr-col-md-8.fr-col-offset-md-2 + .procedure-preview.fr-mb-5w + - if procedure + = render partial: 'shared/procedure_description', locals: { procedure: procedure, full_screen_display: true } + - else + = render partial: 'layouts/commencer/no_procedure' + = yield + +- content_for :footer do + - if procedure + = render partial: 'users/procedure_footer', locals: { procedure: procedure, dossier: @dossier } + - else + = render partial: 'users/dossiers/index_footer' + += render template: 'layouts/application' diff --git a/app/views/prefill_descriptions/edit.html.haml b/app/views/prefill_descriptions/edit.html.haml index 4c94fabf7..8514ed493 100644 --- a/app/views/prefill_descriptions/edit.html.haml +++ b/app/views/prefill_descriptions/edit.html.haml @@ -7,7 +7,7 @@ .two-columns.procedure-context .columns-container .column.procedure-preview - = render partial: 'shared/procedure_description', locals: { procedure: @prefill_description } + = render partial: 'shared/procedure_description', locals: { procedure: @prefill_description, full_screen_display: false } .column.procedure-context-content %p = t("views.prefill_descriptions.edit.intro_html", libelle: @prefill_description.libelle) diff --git a/app/views/shared/_procedure_description.html.haml b/app/views/shared/_procedure_description.html.haml index c5b799a19..23ebfb3e4 100644 --- a/app/views/shared/_procedure_description.html.haml +++ b/app/views/shared/_procedure_description.html.haml @@ -3,7 +3,6 @@ - if procedure.service.present? - procedure_logo_alt = "#{procedure.service.nom} − #{procedure.service.organisme}" = image_tag procedure.logo_url, alt: procedure_logo_alt - - if procedure.euro_flag = image_tag("flag_of_europe.svg", id: 'euro_flag', class: (!procedure.euro_flag ? "hidden" : "")) %h1.procedure-title.fr-h2 @@ -13,10 +12,10 @@ %p %small %span.fr-icon-timer-line - = t('shared.procedure_description.estimated_fill_duration', estimated_minutes: estimated_fill_duration_minutes(procedure)) -= yield +- if full_screen_display + = yield - if procedure.auto_archive_on %details.procedure-configuration--auto-archive @@ -26,23 +25,23 @@ %span.procedure-auto-archive-title Date limite : #{procedure_auto_archive_date(procedure)} %p Vous pouvez déposer vos dossiers jusqu’au #{procedure_auto_archive_datetime(procedure)}. -- if !@hide_description - - if procedure.description.present? - .procedure-description - .procedure-description-body.read-more-enabled.read-more-collapsed{ tabindex: "0", role: "region", "aria-label": t('views.users.dossiers.identite.description') } - = h render SimpleFormatComponent.new(procedure.description, allow_a: true) - = button_tag "Afficher la description complète", class: 'button read-more-button' - - else - .fr-accordions-group - %section.fr-accordion - %h3.fr-accordion__title - %button.fr-accordion__btn{ "aria-controls" => "accordion-114", "aria-expanded" => "true" } Quel est l’objet de cette démarche ? - #accordion-114.fr-collapse.js_description_what - = h render SimpleFormatComponent.new(procedure.description_what, allow_a: true) +- if procedure.description_what.present? && procedure.description_for_who.present? + .fr-accordions-group + %section.fr-accordion + %h3.fr-accordion__title + %button.fr-accordion__btn{ "aria-controls" => "accordion-114", "aria-expanded" => "true" } Quel est l’objet de cette démarche ? + #accordion-114.fr-collapse.js_description_what + = h render SimpleFormatComponent.new(procedure.description_what, allow_a: true) - %section.fr-accordion - %h3.fr-accordion__title - %button.fr-accordion__btn{ "aria-controls" => "accordion-115", "aria-expanded" => "false" } À qui s’adresse la démarche ? - #accordion-115.fr-collapse.js_description_for_who - = h render SimpleFormatComponent.new(procedure.description_for_who, allow_a: true) + %section.fr-accordion + %h3.fr-accordion__title + %button.fr-accordion__btn{ "aria-controls" => "accordion-115", "aria-expanded" => "false" } À qui s’adresse la démarche ? + #accordion-115.fr-collapse.js_description_for_who + = h render SimpleFormatComponent.new(procedure.description_for_who, allow_a: true) + +- else + .procedure-description + .procedure-description-body.read-more-enabled.read-more-collapsed{ tabindex: "0", role: "region", "aria-label": t('views.users.dossiers.identite.description') } + = h render SimpleFormatComponent.new(procedure.description, allow_a: true) + = button_tag "Afficher la description complète", class: 'button read-more-button' diff --git a/spec/support/feature_matchers.rb b/spec/support/feature_matchers.rb index cf771367f..b61c8beee 100644 --- a/spec/support/feature_matchers.rb +++ b/spec/support/feature_matchers.rb @@ -5,9 +5,5 @@ module Capybara def has_procedure_description?(procedure) has_content?(procedure.libelle) && has_content?(procedure.description) && has_content?(procedure.service.email) end - - def has_procedure_sumup_description?(procedure) - has_content?(procedure.libelle) && has_content?(procedure.service.email) - end end end diff --git a/spec/system/administrateurs/procedure_spec_helper.rb b/spec/system/administrateurs/procedure_spec_helper.rb index 134e93ec9..72db34d66 100644 --- a/spec/system/administrateurs/procedure_spec_helper.rb +++ b/spec/system/administrateurs/procedure_spec_helper.rb @@ -1,7 +1,8 @@ module ProcedureSpecHelper def fill_in_dummy_procedure_details(fill_path: true) fill_in 'procedure_libelle', with: 'libelle de la procedure' - fill_in 'procedure_description', with: 'description de la procedure' + fill_in 'procedure_description_what', with: "description de l'objet de la procedure" + fill_in 'procedure_description_for_who', with: "description d'à qui s'adresse la procedure" fill_in 'procedure_cadre_juridique', with: 'cadre juridique' fill_in 'procedure_duree_conservation_dossiers_dans_ds', with: '3' end diff --git a/spec/system/sessions/sign_in_spec.rb b/spec/system/sessions/sign_in_spec.rb index 4057b6f77..c5679805c 100644 --- a/spec/system/sessions/sign_in_spec.rb +++ b/spec/system/sessions/sign_in_spec.rb @@ -43,7 +43,7 @@ describe 'Signin in:' do click_on 'Commencer la démarche' expect(page).to have_current_path identite_dossier_path(user.reload.dossiers.last) - expect(page).to have_procedure_sumup_description(procedure) + expect(page).to have_procedure_description(procedure) expect(page).to have_content "Données d’identité" end end diff --git a/spec/system/users/sign_up_spec.rb b/spec/system/users/sign_up_spec.rb index d6f431d8a..9c77cfbac 100644 --- a/spec/system/users/sign_up_spec.rb +++ b/spec/system/users/sign_up_spec.rb @@ -84,7 +84,7 @@ describe 'Signing up:' do click_on 'Commencer la démarche' expect(page).to have_current_path identite_dossier_path(procedure.reload.dossiers.last) - expect(page).to have_procedure_sumup_description(procedure) + expect(page).to have_procedure_description(procedure) end end diff --git a/spec/views/shared/_procedure_description.html.haml_spec.rb b/spec/views/shared/_procedure_description.html.haml_spec.rb index 431de7fe3..9ced93cc9 100644 --- a/spec/views/shared/_procedure_description.html.haml_spec.rb +++ b/spec/views/shared/_procedure_description.html.haml_spec.rb @@ -2,7 +2,7 @@ describe 'shared/_procedure_description', type: :view do let(:estimated_duration_visible) { true } let(:procedure) { create(:procedure, :published, :with_service, estimated_duration_visible:) } - subject { render partial: 'shared/procedure_description', locals: { procedure: procedure } } + subject { render partial: 'shared/procedure_description', locals: { procedure: procedure, full_screen_display: false } } it 'renders the view' do subject