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
class CommencerController < ApplicationController
layout 'procedure_context'
layout 'procedure_context_full_screen'
def commencer
@procedure = retrieve_procedure

View file

@ -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).

View file

@ -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 lobjet de la démarche ?

View file

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

View file

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

View file

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

View file

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

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
.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)

View file

@ -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 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
.fr-accordions-group
%section.fr-accordion
%h3.fr-accordion__title
%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
= 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 lobjet 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 sadresse 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 sadresse 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'

View file

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

View file

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

View file

@ -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 didentité"
end
end

View file

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

View file

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