refactor(champs): use ViewableChamp::SectionComponent
This commit is contained in:
parent
83cd291593
commit
fd2e253ebc
4 changed files with 4 additions and 5 deletions
|
@ -15,13 +15,13 @@
|
||||||
|
|
||||||
- types_de_champ_public = @dossier.revision.types_de_champ_public
|
- types_de_champ_public = @dossier.revision.types_de_champ_public
|
||||||
- if types_de_champ_public.any? || @dossier.procedure.routing_enabled?
|
- if types_de_champ_public.any? || @dossier.procedure.routing_enabled?
|
||||||
= render partial: "shared/dossiers/champs", locals: { types_de_champ: types_de_champ_public, dossier: @dossier, demande_seen_at: nil, profile: 'instructeur' }
|
= render ViewableChamp::SectionComponent.new(types_de_champ: types_de_champ_public, champs_by_stable_id_with_row: @dossier.champs_by_stable_id_with_row, demande_seen_at: nil, profile: 'instructeur')
|
||||||
|
|
||||||
%h2 Annotations privées
|
%h2 Annotations privées
|
||||||
|
|
||||||
- types_de_champ_private = @dossier.revision.types_de_champ_private
|
- types_de_champ_private = @dossier.revision.types_de_champ_private
|
||||||
- if types_de_champ_private.any?
|
- if types_de_champ_private.any?
|
||||||
= render partial: "shared/dossiers/champs", locals: { types_de_champ: types_de_champ_private, dossier: @dossier, demande_seen_at: nil, profile: 'instructeur' }
|
= render ViewableChamp::SectionComponent.new(types_de_champ: types_de_champ_private, champs_by_stable_id_with_row: @dossier.champs_by_stable_id_with_row, demande_seen_at: nil, profile: 'instructeur')
|
||||||
- else
|
- else
|
||||||
Aucune annotation privée
|
Aucune annotation privée
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
= render ViewableChamp::SectionComponent.new(types_de_champ:, champs_by_stable_id_with_row: dossier.champs_by_stable_id_with_row, demande_seen_at:, profile:)
|
|
|
@ -53,4 +53,4 @@
|
||||||
|
|
||||||
- types_de_champ = dossier.revision.types_de_champ_public
|
- types_de_champ = dossier.revision.types_de_champ_public
|
||||||
- if types_de_champ.any? || dossier.procedure.routing_enabled?
|
- if types_de_champ.any? || dossier.procedure.routing_enabled?
|
||||||
= render partial: "shared/dossiers/champs", locals: { types_de_champ:, dossier:, demande_seen_at:, profile: }
|
= render ViewableChamp::SectionComponent.new(types_de_champ:, champs_by_stable_id_with_row: dossier.champs_by_stable_id_with_row, demande_seen_at:, profile:)
|
||||||
|
|
|
@ -15,7 +15,7 @@ describe 'shared/dossiers/champs', type: :view do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
subject { render 'shared/dossiers/champs', types_de_champ:, dossier:, demande_seen_at:, profile: }
|
subject { render ViewableChamp::SectionComponent.new(types_de_champ:, dossier:, demande_seen_at:, profile:) }
|
||||||
|
|
||||||
context "there are some champs" do
|
context "there are some champs" do
|
||||||
let(:types_de_champ_public) { [{ type: :checkbox }, { type: :header_section }, { type: :explication }, { type: :dossier_link }, { type: :textarea }, { type: :rna }] }
|
let(:types_de_champ_public) { [{ type: :checkbox }, { type: :header_section }, { type: :explication }, { type: :dossier_link }, { type: :textarea }, { type: :rna }] }
|
||||||
|
|
Loading…
Reference in a new issue