create a new layout without procedure for login and use same layout full_screen without description for identite step

This commit is contained in:
Lisa Durand 2023-05-25 15:19:55 +02:00
parent 1c409f0145
commit 31969b290b
15 changed files with 49 additions and 71 deletions

View file

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

View file

@ -92,10 +92,12 @@ module Users
def identite def identite
@dossier = dossier @dossier = dossier
@user = current_user @user = current_user
@no_description = true
end end
def update_identite def update_identite
@dossier = dossier @dossier = dossier
@no_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)
@ -110,10 +112,12 @@ module Users
def siret def siret
@dossier = dossier @dossier = dossier
@no_description = true
end end
def update_siret def update_siret
@dossier = dossier @dossier = dossier
@no_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

@ -5,7 +5,7 @@ class Users::RegistrationsController < Devise::RegistrationsController
# before_action :configure_account_update_params, only: [:update] # before_action :configure_account_update_params, only: [:update]
before_action :restore_procedure_context, only: [:new, :create] before_action :restore_procedure_context, only: [:new, :create]
layout 'procedure_context', only: [:new, :create] layout 'login', only: [:new, :create]
# GET /resource/sign_up # GET /resource/sign_up
def new def new

View file

@ -3,7 +3,7 @@ class Users::SessionsController < Devise::SessionsController
include TrustedDeviceConcern include TrustedDeviceConcern
include ActionView::Helpers::DateHelper include ActionView::Helpers::DateHelper
layout 'procedure_context', only: [:new, :create] layout 'login', only: [:new, :create]
before_action :restore_procedure_context, only: [:new, :create] before_action :restore_procedure_context, only: [:new, :create]

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, full_screen_display: false } = render partial: 'shared/procedure_description', locals: { procedure: @procedure }

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, full_screen_display: false } = render partial: 'shared/procedure_description', locals: { procedure: @procedure }

View file

@ -0,0 +1,17 @@
- procedure = @procedure || @dossier&.procedure || nil
- content_for :content do
.two-columns.procedure-context
.columns-container
.column.procedure-preview
= yield
.column.procedure-context-content
= render partial: 'layouts/commencer/no_procedure'
- 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

@ -1,17 +1,11 @@
- procedure = @procedure || @dossier&.procedure || nil - procedure = @procedure || @dossier&.procedure || nil
- content_for :content do - content_for :content do
.two-columns.procedure-context .fr-container.fr-mt-5w
.columns-container .fr-grid-row
.fr-col-12.fr-col-md-8.fr-col-offset-md-2
.column.procedure-preview .procedure-preview.fr-mb-5w
- if procedure = render partial: 'shared/procedure_description', locals: { procedure: 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 - content_for :footer do
- if procedure - if procedure

View file

@ -1,20 +0,0 @@
- 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, full_screen_display: false } = render partial: 'shared/procedure_description', locals: { procedure: @prefill_description }
.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

@ -14,8 +14,8 @@
%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))
- if full_screen_display
= yield = yield
- if procedure.auto_archive_on - if procedure.auto_archive_on
%details.procedure-configuration--auto-archive %details.procedure-configuration--auto-archive
@ -25,8 +25,8 @@
%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)}.
- unless @no_description
.fr-accordions-group .fr-accordions-group
%section.fr-accordion %section.fr-accordion
%h2.fr-accordion__title %h2.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 ?

View file

@ -35,7 +35,6 @@ describe 'Signin in:' do
scenario 'an existing user can sign-in and fill the procedure' do scenario 'an existing user can sign-in and fill the procedure' do
click_on 'Jai déjà un compte' click_on 'Jai déjà un compte'
expect(page).to have_current_path new_user_session_path expect(page).to have_current_path new_user_session_path
expect(page).to have_procedure_description(procedure)
sign_in_with user.email, password sign_in_with user.email, password
@ -43,7 +42,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_description(procedure) expect(page).to have_content(procedure.libelle)
expect(page).to have_content "Données didentité" expect(page).to have_content "Données didentité"
end end
end end

View file

@ -70,7 +70,6 @@ describe 'Signing up:' do
click_on 'Créer un compte' click_on 'Créer un compte'
expect(page).to have_current_path new_user_registration_path expect(page).to have_current_path new_user_registration_path
expect(page).to have_procedure_description(procedure)
sign_up_with user_email, user_password sign_up_with user_email, user_password
expect(page).to have_content "nous avons besoin de vérifier votre adresse #{user_email}" expect(page).to have_content "nous avons besoin de vérifier votre adresse #{user_email}"
@ -84,7 +83,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_description(procedure) expect(page).to have_content(procedure.libelle)
end end
end end
@ -141,7 +140,6 @@ describe 'Signing up:' do
click_procedure_sign_in_link_for user_email click_procedure_sign_in_link_for user_email
expect(page).to have_current_path new_user_session_path expect(page).to have_current_path new_user_session_path
expect(page).to have_procedure_description(procedure)
end end
end end
end end

View file

@ -51,18 +51,4 @@ describe 'layouts/procedure_context', type: :view do
expect(subject).to have_text(dossier.procedure.service.email) expect(subject).to have_text(dossier.procedure.service.email)
end end
end end
context 'when neither procedure or dossier are assigned' do
it 'renders a placeholder for the procedure' do
expect(subject).to have_selector('.no-procedure')
end
it 'renders the inner content' do
expect(subject).to have_text('Column content')
end
it 'renders a generic footer' do
expect(subject).to have_text('Mentions légales')
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, full_screen_display: false } } subject { render partial: 'shared/procedure_description', locals: { procedure: procedure } }
it 'renders the view' do it 'renders the view' do
subject subject