From 26df3aaa587a7f762e0e06c16748d85e2ed09730 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 7 Apr 2022 11:42:20 +0200 Subject: [PATCH] refactor(dossier): remove preview special case --- app/helpers/application_helper.rb | 2 +- app/views/administrateurs/procedures/apercu.html.haml | 2 +- app/views/shared/dossiers/_edit.html.haml | 6 +++--- app/views/users/dossiers/brouillon.html.haml | 4 ++-- app/views/users/dossiers/modifier.html.haml | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 39f04b140..6572b58bb 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -62,7 +62,7 @@ module ApplicationHelper def render_champ(champ) champ_selector = "##{champ.input_group_id}" - form_html = render 'shared/dossiers/edit', dossier: champ.dossier, apercu: false + form_html = render 'shared/dossiers/edit', dossier: champ.dossier champ_html = Nokogiri::HTML.fragment(form_html).at_css(champ_selector).to_s # rubocop:disable Rails/OutputSafety raw("document.querySelector('#{champ_selector}').outerHTML = \"#{escape_javascript(champ_html)}\";") diff --git a/app/views/administrateurs/procedures/apercu.html.haml b/app/views/administrateurs/procedures/apercu.html.haml index 2e122c31a..53bd9beb7 100644 --- a/app/views/administrateurs/procedures/apercu.html.haml +++ b/app/views/administrateurs/procedures/apercu.html.haml @@ -13,7 +13,7 @@ active: @tab == 'annotations-privees') - if @tab == 'dossier' - = render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: true } + = render partial: "shared/dossiers/edit", locals: { dossier: @dossier } - else .container = form_for @dossier, url: '', method: :get, html: { class: 'form' } do |f| diff --git a/app/views/shared/dossiers/_edit.html.haml b/app/views/shared/dossiers/_edit.html.haml index c63c67368..23a7b1362 100644 --- a/app/views/shared/dossiers/_edit.html.haml +++ b/app/views/shared/dossiers/_edit.html.haml @@ -1,7 +1,7 @@ .dossier-edit.container = render partial: "shared/dossiers/submit_is_over", locals: { dossier: dossier } - - if apercu + - if dossier.for_procedure_preview? - form_options = { url: '', method: :get } - elsif dossier.brouillon? - form_options = { url: brouillon_dossier_url(dossier), method: :patch } @@ -18,7 +18,7 @@ = t('views.shared.dossiers.edit.autosave') - else Pour enregistrer votre dossier et le reprendre plus tard, cliquez sur le bouton « Enregistrer le brouillon » en bas à gauche du formulaire. - - if !apercu && dossier.france_connect_information.present? + - if dossier.france_connect_information.present? = render partial: "shared/dossiers/france_connect_informations", locals: { user_information: dossier.france_connect_information } - if notice_url(dossier.procedure).present? = link_to notice_url(dossier.procedure), target: '_blank', rel: 'noopener', class: 'button notice', title: "Pour vous aider à remplir votre dossier, vous pouvez consulter le guide de cette démarche." do @@ -40,7 +40,7 @@ = render partial: "shared/dossiers/editable_champs/editable_champ", locals: { champ: champ, form: champ_form } - - if !apercu + - if !dossier.for_procedure_preview? .dossier-edit-sticky-footer .send-dossier-actions-bar - if dossier.brouillon? diff --git a/app/views/users/dossiers/brouillon.html.haml b/app/views/users/dossiers/brouillon.html.haml index c838a6615..4b0f2ca7e 100644 --- a/app/views/users/dossiers/brouillon.html.haml +++ b/app/views/users/dossiers/brouillon.html.haml @@ -7,6 +7,6 @@ .dossier-container .dossier-header.sub-header .container - = render partial: "shared/dossiers/header", locals: { dossier: @dossier, apercu: false } + = render partial: "shared/dossiers/header", locals: { dossier: @dossier } - = render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: false } + = render partial: "shared/dossiers/edit", locals: { dossier: @dossier } diff --git a/app/views/users/dossiers/modifier.html.haml b/app/views/users/dossiers/modifier.html.haml index 41c4a3512..7217909e0 100644 --- a/app/views/users/dossiers/modifier.html.haml +++ b/app/views/users/dossiers/modifier.html.haml @@ -7,4 +7,4 @@ = render partial: 'users/dossiers/show/header', locals: { dossier: @dossier } .container - = render partial: "shared/dossiers/edit", locals: { dossier: @dossier, apercu: false } + = render partial: "shared/dossiers/edit", locals: { dossier: @dossier }