form: move the procedure notice link to a button

This commit is contained in:
Pierre de La Morinerie 2018-07-11 17:11:44 +02:00 committed by gregoirenovel
parent 2ef6f46ef4
commit 0282994990
3 changed files with 35 additions and 10 deletions

View file

@ -15,7 +15,20 @@
}
}
.thanks {
padding: (1.5 * $default-padding) 0;
.prologue {
margin: (1.5 * $default-padding) 0;
display: flex;
flex-wrap: wrap;
align-items: baseline;
.mandatory-explanation {
flex-grow: 1; // Push the "notice" button to the right
flex-shrink: 1; // Allow the text to shrink
margin-bottom: $default-spacer; // Leave space when the "notice" button wraps under the text
}
.button.notice {
flex-shrink: 0; // Display the button label on a single line
}
}
}

View file

@ -8,16 +8,19 @@
= form_for dossier, form_options do |f|
- if notice_url(dossier.procedure).present?
%p
Pour vous aider à remplir votre dossier, vous pouvez consulter
= link_to 'le guide de cette démarche', notice_url(dossier.procedure), { target: '_blank' }
%p.thanks
.prologue
.mandatory-explanation
Les champs avec une astérisque (
%span.mandatory> *
) sont obligatoires.
- if notice_url(dossier.procedure).present?
= link_to notice_url(dossier.procedure), class: 'button notice', title: "Pour vous aider à remplir votre dossier, vous pouvez consulter le guide de cette démarche." do
%span.icon.info>
Guide de la démarche
%hr
= f.fields_for :champs, dossier.champs do |champ_form|
- champ = champ_form.object
= render partial: "shared/dossiers/editable_champs/editable_champ",

View file

@ -16,6 +16,10 @@ describe 'new_user/dossiers/modifier.html.haml', type: :view do
expect(rendered).to have_text(dossier.procedure.libelle)
end
it 'affiche un lien vers la notice' do
expect(rendered).to have_link("Guide de la démarche", href: url_for(procedure.notice))
end
it 'affiche les boutons de validation' do
expect(rendered).to have_selector('.send-wrapper')
end
@ -23,4 +27,9 @@ describe 'new_user/dossiers/modifier.html.haml', type: :view do
it 'prépare le footer' do
expect(footer).to have_selector('footer')
end
context 'quand la procédure ne comporte pas de notice' do
let(:procedure) { create(:procedure) }
it { is_expected.not_to have_link("Guide de la démarche") }
end
end