refactor(dossier): remove preview special case

This commit is contained in:
Paul Chavard 2022-04-07 11:42:20 +02:00
parent 669b3ce5c3
commit 26df3aaa58
5 changed files with 8 additions and 8 deletions

View file

@ -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)}\";")

View file

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

View file

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

View file

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

View file

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