dossier: display user infos on edit page

This commit is contained in:
Pierre de La Morinerie 2018-06-19 14:23:43 +00:00
parent c1db26b2e1
commit c4057a0807
12 changed files with 180 additions and 4 deletions

View file

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

View file

@ -29,6 +29,10 @@ h2 {
border-bottom: 1px solid $border-grey; border-bottom: 1px solid $border-grey;
} }
strong {
font-weight: bold;
}
a { a {
color: $blue; color: $blue;
} }

View file

@ -254,9 +254,11 @@
.send-wrapper { .send-wrapper {
text-align: right; text-align: right;
margin-top: 2 * $default-padding;
margin-bottom: 2 * $default-padding;
.send { .button {
margin-bottom: $default-padding; margin-bottom: 0;
} }
} }

View file

@ -4,13 +4,21 @@
@import "placeholders"; @import "placeholders";
footer { footer {
@include vertical-padding(72px);
background-color: $light-grey; background-color: $light-grey;
border-top: 1px solid $border-grey; border-top: 1px solid $border-grey;
bottom: 0; bottom: 0;
width: 100%; width: 100%;
} }
.landing-footer {
@include vertical-padding(72px);
}
.dossier-footer {
@include vertical-padding(48px);
line-height: 24px;
}
.footer-columns { .footer-columns {
@extend %horizontal-list; @extend %horizontal-list;
justify-content: flex-start; justify-content: flex-start;
@ -36,6 +44,12 @@ footer {
margin: 0; margin: 0;
} }
.footer-header {
font-size: 14px;
font-weight: bold;
margin-bottom: 10px;
}
.footer-link { .footer-link {
margin-bottom: 14px; margin-bottom: 14px;
@ -79,3 +93,10 @@ footer {
text-decoration: none; text-decoration: none;
} }
} }
.footer-bottom-line {
margin-top: 30px;
margin-bottom: -30px;
text-align: center;
font-size: small;
}

View file

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

View file

@ -1,3 +1,6 @@
- content_for :footer do
= render partial: "new_user/dossiers/footer", locals: { dossier: @dossier }
.two-columns .two-columns
.columns-container .columns-container
.column.preview .column.preview
@ -11,7 +14,7 @@
.procedure-description .procedure-description
= h string_to_html(@dossier.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| = form_for @dossier.individual, url: update_identite_dossier_path(@dossier), html: { class: "form" } do |f|
%h1 Données d'identité %h1 Données d'identité

View file

@ -1,3 +1,6 @@
- content_for :footer do
= render partial: "new_user/dossiers/footer", locals: { dossier: @dossier }
.dossier-edit .dossier-edit
.dossier-header .dossier-header
.container .container

View file

@ -18,6 +18,12 @@ FactoryBot.define do
end end
end end
trait :with_service do
after(:build) do |dossier, _evaluator|
dossier.procedure.service = create(:service)
end
end
trait :for_individual do trait :for_individual do
after(:build) do |dossier, _evaluator| after(:build) do |dossier, _evaluator|
dossier.individual = create(:individual) dossier.individual = create(:individual)

View file

@ -20,6 +20,12 @@ FactoryBot.define do
end end
end end
trait :with_service do
after(:build) do |procedure, _evaluator|
procedure.service = create(:service)
end
end
trait :with_api_carto do trait :with_api_carto do
after(:build) do |procedure, _evaluator| after(:build) do |procedure, _evaluator|
procedure.module_api_carto.use_api_carto = true procedure.module_api_carto.use_api_carto = true

View file

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

View file

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

View file

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