add new layout to handle new full screen design

This commit is contained in:
Lisa Durand 2023-05-23 15:24:42 +02:00
parent b6cc35df68
commit 6274594c70
15 changed files with 66 additions and 52 deletions

View file

@ -1,6 +1,6 @@
module Users module Users
class CommencerController < ApplicationController class CommencerController < ApplicationController
layout 'procedure_context' layout 'procedure_context_full_screen'
def commencer def commencer
@procedure = retrieve_procedure @procedure = retrieve_procedure

View file

@ -92,12 +92,10 @@ module Users
def identite def identite
@dossier = dossier @dossier = dossier
@user = current_user @user = current_user
@hide_description = true
end end
def update_identite def update_identite
@dossier = dossier @dossier = dossier
@hide_description = true
if @dossier.individual.update(individual_params) if @dossier.individual.update(individual_params)
@dossier.update!(autorisation_donnees: true, identity_updated_at: Time.zone.now) @dossier.update!(autorisation_donnees: true, identity_updated_at: Time.zone.now)
@ -112,12 +110,10 @@ module Users
def siret def siret
@dossier = dossier @dossier = dossier
@hide_description = true
end end
def update_siret def update_siret
@dossier = dossier @dossier = dossier
@hide_description = true
# We use the user as the holder model object for the siret value # 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). # (so that we can restore it on the form in case of error).

View file

@ -6,7 +6,7 @@
= f.label :libelle do = f.label :libelle do
Titre de la démarche Titre de la démarche
%span.mandatory * %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 = f.label :description_what do
Quel est lobjet de la démarche ? Quel est lobjet de la démarche ?

View file

@ -25,4 +25,4 @@
.procedure-form__preview.sticky--top .procedure-form__preview.sticky--top
%h3.procedure-form__preview-title Aperçu %h3.procedure-form__preview-title Aperçu
.procedure-preview .procedure-preview
= render partial: 'shared/procedure_description', locals: { procedure: @procedure } = render partial: 'shared/procedure_description', locals: { procedure: @procedure, full_screen_display: false }

View file

@ -25,4 +25,4 @@
.procedure-form__preview.sticky--top .procedure-form__preview.sticky--top
%h3.procedure-form__preview-title Aperçu %h3.procedure-form__preview-title Aperçu
.procedure-preview .procedure-preview
= render partial: 'shared/procedure_description', locals: { procedure: @procedure } = render partial: 'shared/procedure_description', locals: { procedure: @procedure, full_screen_display: false }

View file

@ -2,7 +2,7 @@
.commencer.form .commencer.form
- if !user_signed_in? - 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 - c.body do
= render partial: 'shared/france_connect_login', locals: { url: commencer_france_connect_path(path: @procedure.path, prefill_token: @prefilled_dossier&.prefill_token) } = 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 = 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) - not_drafts = dossiers.merge(Dossier.state_not_brouillon)
- if @prefilled_dossier - 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 - 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) %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' = 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? - elsif drafts.size == 1 && not_drafts.empty?
- dossier = drafts.first - 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 - c.body do
%p %p
= t('views.commencer.show.already_draft_detail_html', time_ago: time_ago_in_words(dossier.created_at), procedure: dossier.procedure.libelle) = 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 - elsif not_drafts.size == 1
- dossier = not_drafts.first - 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 - c.body do
%p %p
= t('views.commencer.show.already_not_draft_detail_html', time_ago: time_ago_in_words(dossier.depose_at), procedure: dossier.procedure.libelle) = 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' = link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: 'fr-btn fr-btn--secondary fr-mb-2w'
- else - 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 - 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.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" = link_to t('views.commencer.show.start_new_file'), url_for_new_dossier(@revision), class: "fr-btn fr-btn--secondary fr-mb-2w"

View file

@ -1,15 +1,17 @@
- procedure = @procedure || @dossier&.procedure || nil - procedure = @procedure || @dossier&.procedure || nil
- content_for :content do - content_for :content do
.fr-container.fr-mt-5w .two-columns.procedure-context
.fr-grid-row .columns-container
.fr-col-12.fr-col-md-8.fr-col-offset-md-2
.procedure-preview.fr-mb-5w .column.procedure-preview
- if procedure - if procedure
= render partial: 'shared/procedure_description', locals: { procedure: procedure } = render partial: 'shared/procedure_description', locals: { procedure: procedure, full_screen_display: false }
- else - else
= render partial: 'layouts/commencer/no_procedure' = render partial: 'layouts/commencer/no_procedure'
= yield
.column.procedure-context-content
= yield
- content_for :footer do - content_for :footer do
- if procedure - if procedure

View file

@ -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'

View file

@ -7,7 +7,7 @@
.two-columns.procedure-context .two-columns.procedure-context
.columns-container .columns-container
.column.procedure-preview .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 .column.procedure-context-content
%p %p
= t("views.prefill_descriptions.edit.intro_html", libelle: @prefill_description.libelle) = t("views.prefill_descriptions.edit.intro_html", libelle: @prefill_description.libelle)

View file

@ -3,7 +3,6 @@
- if procedure.service.present? - if procedure.service.present?
- procedure_logo_alt = "#{procedure.service.nom} #{procedure.service.organisme}" - procedure_logo_alt = "#{procedure.service.nom} #{procedure.service.organisme}"
= image_tag procedure.logo_url, alt: procedure_logo_alt = image_tag procedure.logo_url, alt: procedure_logo_alt
- if procedure.euro_flag - if procedure.euro_flag
= image_tag("flag_of_europe.svg", id: 'euro_flag', class: (!procedure.euro_flag ? "hidden" : "")) = image_tag("flag_of_europe.svg", id: 'euro_flag', class: (!procedure.euro_flag ? "hidden" : ""))
%h1.procedure-title.fr-h2 %h1.procedure-title.fr-h2
@ -13,10 +12,10 @@
%p %p
%small %small
%span.fr-icon-timer-line %span.fr-icon-timer-line
= t('shared.procedure_description.estimated_fill_duration', estimated_minutes: estimated_fill_duration_minutes(procedure)) = 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 - if procedure.auto_archive_on
%details.procedure-configuration--auto-archive %details.procedure-configuration--auto-archive
@ -26,23 +25,23 @@
%span.procedure-auto-archive-title Date limite : #{procedure_auto_archive_date(procedure)} %span.procedure-auto-archive-title Date limite : #{procedure_auto_archive_date(procedure)}
%p Vous pouvez déposer vos dossiers jusquau #{procedure_auto_archive_datetime(procedure)}. %p Vous pouvez déposer vos dossiers jusquau #{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 - if procedure.description_what.present? && procedure.description_for_who.present?
.fr-accordions-group .fr-accordions-group
%section.fr-accordion %section.fr-accordion
%h3.fr-accordion__title %h3.fr-accordion__title
%button.fr-accordion__btn{ "aria-controls" => "accordion-114", "aria-expanded" => "true" } Quel est lobjet de cette démarche ? %button.fr-accordion__btn{ "aria-controls" => "accordion-114", "aria-expanded" => "true" } Quel est lobjet de cette démarche ?
#accordion-114.fr-collapse.js_description_what #accordion-114.fr-collapse.js_description_what
= h render SimpleFormatComponent.new(procedure.description_what, allow_a: true) = h render SimpleFormatComponent.new(procedure.description_what, allow_a: true)
%section.fr-accordion %section.fr-accordion
%h3.fr-accordion__title %h3.fr-accordion__title
%button.fr-accordion__btn{ "aria-controls" => "accordion-115", "aria-expanded" => "false" } À qui sadresse la démarche ? %button.fr-accordion__btn{ "aria-controls" => "accordion-115", "aria-expanded" => "false" } À qui sadresse la démarche ?
#accordion-115.fr-collapse.js_description_for_who #accordion-115.fr-collapse.js_description_for_who
= h render SimpleFormatComponent.new(procedure.description_for_who, allow_a: true) = 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'

View file

@ -5,9 +5,5 @@ module Capybara
def has_procedure_description?(procedure) def has_procedure_description?(procedure)
has_content?(procedure.libelle) && has_content?(procedure.description) && has_content?(procedure.service.email) has_content?(procedure.libelle) && has_content?(procedure.description) && has_content?(procedure.service.email)
end end
def has_procedure_sumup_description?(procedure)
has_content?(procedure.libelle) && has_content?(procedure.service.email)
end
end end
end end

View file

@ -1,7 +1,8 @@
module ProcedureSpecHelper module ProcedureSpecHelper
def fill_in_dummy_procedure_details(fill_path: true) def fill_in_dummy_procedure_details(fill_path: true)
fill_in 'procedure_libelle', with: 'libelle de la procedure' 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_cadre_juridique', with: 'cadre juridique'
fill_in 'procedure_duree_conservation_dossiers_dans_ds', with: '3' fill_in 'procedure_duree_conservation_dossiers_dans_ds', with: '3'
end end

View file

@ -43,7 +43,7 @@ describe 'Signin in:' do
click_on 'Commencer la démarche' click_on 'Commencer la démarche'
expect(page).to have_current_path identite_dossier_path(user.reload.dossiers.last) 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 didentité" expect(page).to have_content "Données didentité"
end end
end end

View file

@ -84,7 +84,7 @@ describe 'Signing up:' do
click_on 'Commencer la démarche' click_on 'Commencer la démarche'
expect(page).to have_current_path identite_dossier_path(procedure.reload.dossiers.last) 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
end end

View file

@ -2,7 +2,7 @@ describe 'shared/_procedure_description', type: :view do
let(:estimated_duration_visible) { true } let(:estimated_duration_visible) { true }
let(:procedure) { create(:procedure, :published, :with_service, estimated_duration_visible:) } 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 it 'renders the view' do
subject subject