diff --git a/app/assets/stylesheets/new_design/dossier-edit.scss b/app/assets/stylesheets/new_design/dossier-edit.scss index a2bd0a6fb..cce0af864 100644 --- a/app/assets/stylesheets/new_design/dossier-edit.scss +++ b/app/assets/stylesheets/new_design/dossier-edit.scss @@ -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 + } } } diff --git a/app/views/shared/dossiers/_edit.html.haml b/app/views/shared/dossiers/_edit.html.haml index e03afa09e..83f4d2867 100644 --- a/app/views/shared/dossiers/_edit.html.haml +++ b/app/views/shared/dossiers/_edit.html.haml @@ -8,15 +8,18 @@ = 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' } + .prologue + .mandatory-explanation + Les champs avec une astérisque ( + %span.mandatory> * + ) sont obligatoires. - %p.thanks - 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 diff --git a/spec/views/new_user/dossiers/modifier.html.haml_spec.rb b/spec/views/new_user/dossiers/modifier.html.haml_spec.rb index 3fbfa3d1f..7db3fce4e 100644 --- a/spec/views/new_user/dossiers/modifier.html.haml_spec.rb +++ b/spec/views/new_user/dossiers/modifier.html.haml_spec.rb @@ -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