refactor(user/dossier): explicitly pass dossier_for_editing in to views
This commit is contained in:
parent
fb6adabfc5
commit
6914d78236
6 changed files with 8 additions and 8 deletions
|
@ -13,6 +13,6 @@
|
||||||
active: @tab == 'annotations-privees')
|
active: @tab == 'annotations-privees')
|
||||||
|
|
||||||
- if @tab == 'dossier'
|
- if @tab == 'dossier'
|
||||||
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier }
|
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, dossier_for_editing: @dossier }
|
||||||
- else
|
- else
|
||||||
= render partial: "shared/dossiers/edit_annotations", locals: { dossier: @dossier, seen_at: nil }
|
= render partial: "shared/dossiers/edit_annotations", locals: { dossier: @dossier, seen_at: nil }
|
||||||
|
|
|
@ -12,4 +12,4 @@
|
||||||
.fr-container
|
.fr-container
|
||||||
%h2.fr-h4= t('.title')
|
%h2.fr-h4= t('.title')
|
||||||
|
|
||||||
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier }
|
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, dossier_for_editing: @dossier }
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
- dossier_for_editing = dossier.en_construction? ? dossier.owner_editing_fork : dossier
|
|
||||||
|
|
||||||
- if dossier.france_connected_with_one_identity? && current_user.instructeur? && !current_user.owns_or_invite?(dossier)
|
- if dossier.france_connected_with_one_identity? && current_user.instructeur? && !current_user.owns_or_invite?(dossier)
|
||||||
- content_for(:notice_info) do
|
- content_for(:notice_info) do
|
||||||
= render partial: "shared/dossiers/france_connect_informations_notice", locals: { user_information: dossier.user.france_connect_informations.first }
|
= render partial: "shared/dossiers/france_connect_informations_notice", locals: { user_information: dossier.user.france_connect_informations.first }
|
||||||
|
@ -10,7 +8,7 @@
|
||||||
= render NestedForms::FormOwnerComponent.new
|
= render NestedForms::FormOwnerComponent.new
|
||||||
= form_for dossier_for_editing, url: brouillon_dossier_url(dossier), method: :patch, html: { id: 'dossier-edit-form', class: 'form', multipart: true, novalidate: 'novalidate' } do |f|
|
= form_for dossier_for_editing, url: brouillon_dossier_url(dossier), method: :patch, html: { id: 'dossier-edit-form', class: 'form', multipart: true, novalidate: 'novalidate' } do |f|
|
||||||
|
|
||||||
= render Dossiers::ErrorsFullMessagesComponent.new(dossier: dossier)
|
= render Dossiers::ErrorsFullMessagesComponent.new(dossier: dossier_for_editing)
|
||||||
%header.mb-6
|
%header.mb-6
|
||||||
.fr-highlight
|
.fr-highlight
|
||||||
%p.fr-text--sm
|
%p.fr-text--sm
|
||||||
|
|
|
@ -9,4 +9,4 @@
|
||||||
.fr-container
|
.fr-container
|
||||||
= render partial: "shared/dossiers/header", locals: { dossier: @dossier }
|
= render partial: "shared/dossiers/header", locals: { dossier: @dossier }
|
||||||
|
|
||||||
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier }
|
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, dossier_for_editing: @dossier }
|
||||||
|
|
|
@ -7,4 +7,4 @@
|
||||||
= render partial: 'users/dossiers/show/header', locals: { dossier: @dossier }
|
= render partial: 'users/dossiers/show/header', locals: { dossier: @dossier }
|
||||||
|
|
||||||
.container
|
.container
|
||||||
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier }
|
= render partial: "shared/dossiers/edit", locals: { dossier: @dossier, dossier_for_editing: @dossier_for_editing }
|
||||||
|
|
|
@ -6,10 +6,11 @@ describe 'shared/dossiers/edit', type: :view do
|
||||||
allow(view).to receive(:administrateur_signed_in?).and_return(false)
|
allow(view).to receive(:administrateur_signed_in?).and_return(false)
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { render 'shared/dossiers/edit', dossier: dossier, apercu: false }
|
subject { render 'shared/dossiers/edit', dossier:, dossier_for_editing:, apercu: false }
|
||||||
|
|
||||||
let(:procedure) { create(:procedure, types_de_champ_public:) }
|
let(:procedure) { create(:procedure, types_de_champ_public:) }
|
||||||
let(:dossier) { create(:dossier, :with_populated_champs, procedure:) }
|
let(:dossier) { create(:dossier, :with_populated_champs, procedure:) }
|
||||||
|
let(:dossier_for_editing) { dossier }
|
||||||
|
|
||||||
context 'when there are some champs' do
|
context 'when there are some champs' do
|
||||||
let(:type_de_champ_header_section) { procedure.draft_types_de_champ_public.find(&:header_section?) }
|
let(:type_de_champ_header_section) { procedure.draft_types_de_champ_public.find(&:header_section?) }
|
||||||
|
@ -116,6 +117,7 @@ describe 'shared/dossiers/edit', type: :view do
|
||||||
|
|
||||||
context 'when dossier is en construction' do
|
context 'when dossier is en construction' do
|
||||||
let(:dossier) { create(:dossier, :en_construction, :with_populated_champs, procedure:) }
|
let(:dossier) { create(:dossier, :en_construction, :with_populated_champs, procedure:) }
|
||||||
|
let(:dossier_for_editing) { dossier.owner_editing_fork }
|
||||||
|
|
||||||
it 'can delete a piece justificative' do
|
it 'can delete a piece justificative' do
|
||||||
expect(subject).to have_selector("[title='Supprimer le fichier #{champ.piece_justificative_file.attachments[0].filename}']")
|
expect(subject).to have_selector("[title='Supprimer le fichier #{champ.piece_justificative_file.attachments[0].filename}']")
|
||||||
|
|
Loading…
Reference in a new issue