diff --git a/app/assets/stylesheets/new_design/auth.scss b/app/assets/stylesheets/new_design/auth.scss index 2ad56545b..4aae42a3d 100644 --- a/app/assets/stylesheets/new_design/auth.scss +++ b/app/assets/stylesheets/new_design/auth.scss @@ -111,3 +111,11 @@ $auth-breakpoint: $two-columns-breakpoint; } } } + +.identity-form { + @media (max-width: $two-columns-breakpoint) { + input[type=submit] { + margin-bottom: 2 * $default-padding; + } + } +} diff --git a/app/assets/stylesheets/new_design/common.scss b/app/assets/stylesheets/new_design/common.scss index 36f4fff39..bc18e7ff0 100644 --- a/app/assets/stylesheets/new_design/common.scss +++ b/app/assets/stylesheets/new_design/common.scss @@ -29,6 +29,10 @@ h2 { border-bottom: 1px solid $border-grey; } +strong { + font-weight: bold; +} + a { color: $blue; } diff --git a/app/assets/stylesheets/new_design/forms.scss b/app/assets/stylesheets/new_design/forms.scss index 866c98c14..b60b2ba5e 100644 --- a/app/assets/stylesheets/new_design/forms.scss +++ b/app/assets/stylesheets/new_design/forms.scss @@ -254,9 +254,11 @@ .send-wrapper { text-align: right; + margin-top: 2 * $default-padding; + margin-bottom: 2 * $default-padding; - .send { - margin-bottom: $default-padding; + .button { + margin-bottom: 0; } } diff --git a/app/assets/stylesheets/new_design/new_footer.scss b/app/assets/stylesheets/new_design/new_footer.scss index 91aa8fe19..35966b2a4 100644 --- a/app/assets/stylesheets/new_design/new_footer.scss +++ b/app/assets/stylesheets/new_design/new_footer.scss @@ -4,13 +4,21 @@ @import "placeholders"; footer { - @include vertical-padding(72px); background-color: $light-grey; border-top: 1px solid $border-grey; bottom: 0; width: 100%; } +.landing-footer { + @include vertical-padding(72px); +} + +.dossier-footer { + @include vertical-padding(48px); + line-height: 24px; +} + .footer-columns { @extend %horizontal-list; justify-content: flex-start; @@ -36,6 +44,12 @@ footer { margin: 0; } +.footer-header { + font-size: 14px; + font-weight: bold; + margin-bottom: 10px; +} + .footer-link { margin-bottom: 14px; @@ -79,3 +93,10 @@ footer { text-decoration: none; } } + +.footer-bottom-line { + margin-top: 30px; + margin-bottom: -30px; + text-align: center; + font-size: small; +} diff --git a/app/views/new_user/dossiers/_footer.html.haml b/app/views/new_user/dossiers/_footer.html.haml new file mode 100644 index 000000000..59d04ecb0 --- /dev/null +++ b/app/views/new_user/dossiers/_footer.html.haml @@ -0,0 +1,39 @@ +%footer.dossier-footer + .container + %ul.footer-columns + + - service = dossier.procedure.service + - if service.present? + %li.footer-column + %h3.footer-header Cette démarche est gérée par : + %p + = service.nom + %br + = service.organisme + %br + = string_to_html(service.adresse) + + %li.footer-column + %h3.footer-header Poser une question sur votre dossier : + %p + - if dossier.brouillon? + Par email : + = link_to service.email, "mailto:#{service.email}" + - else + Directement + = link_to "par la messagerie", users_dossier_recapitulatif_path(dossier) + %p + Par téléphone : + %a{ href: "tel:#{service.telephone}" }= service.telephone + + %p + Horaires : #{ service.horaires.sub(/\S/, &:downcase) } + + .footer-bottom-line + = link_to "Accessibilité", accessibilite_index_path, :class => "footer-link" + – + = link_to "CGU", CGU_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" + – + = link_to "Mentions légales", MENTIONS_LEGALES_URL, :class => "footer-link", :target => "_blank", rel: "noopener noreferrer" + – + = link_to "Contact technique", "mailto:#{CONTACT_EMAIL}", :class => "footer-link" diff --git a/app/views/new_user/dossiers/identite.html.haml b/app/views/new_user/dossiers/identite.html.haml index 6847dc8f6..5e5aa4349 100644 --- a/app/views/new_user/dossiers/identite.html.haml +++ b/app/views/new_user/dossiers/identite.html.haml @@ -1,3 +1,6 @@ +- content_for :footer do + = render partial: "new_user/dossiers/footer", locals: { dossier: @dossier } + .two-columns .columns-container .column.preview @@ -11,7 +14,7 @@ .procedure-description = h string_to_html(@dossier.procedure.description) - .column + .column.identity-form = form_for @dossier.individual, url: update_identite_dossier_path(@dossier), html: { class: "form" } do |f| %h1 Données d'identité diff --git a/app/views/new_user/dossiers/modifier.html.haml b/app/views/new_user/dossiers/modifier.html.haml index 41ee58623..169aca13c 100644 --- a/app/views/new_user/dossiers/modifier.html.haml +++ b/app/views/new_user/dossiers/modifier.html.haml @@ -1,3 +1,6 @@ +- content_for :footer do + = render partial: "new_user/dossiers/footer", locals: { dossier: @dossier } + .dossier-edit .dossier-header .container diff --git a/spec/factories/dossier.rb b/spec/factories/dossier.rb index 2391915ee..a41fed27b 100644 --- a/spec/factories/dossier.rb +++ b/spec/factories/dossier.rb @@ -18,6 +18,12 @@ FactoryBot.define do end end + trait :with_service do + after(:build) do |dossier, _evaluator| + dossier.procedure.service = create(:service) + end + end + trait :for_individual do after(:build) do |dossier, _evaluator| dossier.individual = create(:individual) diff --git a/spec/factories/procedure.rb b/spec/factories/procedure.rb index b24fb1563..7d93b2eac 100644 --- a/spec/factories/procedure.rb +++ b/spec/factories/procedure.rb @@ -20,6 +20,12 @@ FactoryBot.define do end end + trait :with_service do + after(:build) do |procedure, _evaluator| + procedure.service = create(:service) + end + end + trait :with_api_carto do after(:build) do |procedure, _evaluator| procedure.module_api_carto.use_api_carto = true diff --git a/spec/views/new_user/dossiers/_footer.html.haml_spec.rb b/spec/views/new_user/dossiers/_footer.html.haml_spec.rb new file mode 100644 index 000000000..d840c876e --- /dev/null +++ b/spec/views/new_user/dossiers/_footer.html.haml_spec.rb @@ -0,0 +1,30 @@ +describe 'new_user/dossiers/_footer.html.haml', type: :view do + let(:service) { create(:service) } + let(:dossier) { + dossier = create(:dossier) + dossier.procedure.service = service + return dossier + } + + subject { render 'new_user/dossiers/footer.html.haml', dossier: dossier } + + it "affiche les informations de contact" do + expect(subject).to have_text(service.nom) + expect(subject).to have_text(service.organisme) + expect(subject).to have_text(service.telephone) + end + + it "affiche les liens usuels requis" do + expect(subject).to have_link("Accessibilité") + expect(subject).to have_link("CGU") + expect(subject).to have_link("Mentions légales") + end + + context "quand le dossier n'a pas de service associé" do + let(:service) { nil } + + it { is_expected.to have_selector("footer") } + it { is_expected.to have_link("Accessibilité") } + it { is_expected.not_to have_text('téléphone') } + end +end diff --git a/spec/views/new_user/dossiers/identite.html.haml_spec.rb b/spec/views/new_user/dossiers/identite.html.haml_spec.rb new file mode 100644 index 000000000..4eaa8c4ea --- /dev/null +++ b/spec/views/new_user/dossiers/identite.html.haml_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +describe 'new_user/dossiers/identite.html.haml', type: :view do + let(:dossier) { create(:dossier, :with_entreprise, :with_service, state: 'brouillon', procedure: create(:procedure, :with_api_carto, :with_two_type_de_piece_justificative, for_individual: true)) } + let(:footer) { view.content_for(:footer) } + + before do + sign_in dossier.user + assign(:dossier, dossier) + end + + context 'test de composition de la page' do + before do + render + end + + it 'affiche les informations de la procédure' do + expect(rendered).to have_text(dossier.procedure.libelle) + end + + it 'prépare le footer' do + expect(footer).to have_selector('footer') + end + end +end diff --git a/spec/views/new_user/dossiers/modifier.html.haml_spec.rb b/spec/views/new_user/dossiers/modifier.html.haml_spec.rb new file mode 100644 index 000000000..d6ee1e0e4 --- /dev/null +++ b/spec/views/new_user/dossiers/modifier.html.haml_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' + +describe 'new_user/dossiers/modifier.html.haml', type: :view do + let(:dossier) { create(:dossier, :with_entreprise, :with_service, state: 'brouillon', procedure: create(:procedure, :with_api_carto, :with_two_type_de_piece_justificative, for_individual: true)) } + let(:footer) { view.content_for(:footer) } + + before do + sign_in dossier.user + assign(:dossier, dossier) + end + + context 'test de composition de la page' do + before do + render + end + + it 'affiche le libellé de la procédure' do + expect(rendered).to have_text(dossier.procedure.libelle) + end + + it 'affiche les boutons de validation' do + expect(rendered).to have_selector('.send-wrapper') + end + + it 'prépare le footer' do + expect(footer).to have_selector('footer') + end + end +end