add list of PJ in procedure description
This commit is contained in:
parent
d22c0f47f3
commit
d2f91a6405
5 changed files with 44 additions and 4 deletions
|
@ -965,6 +965,14 @@ class Procedure < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pieces_jointes_list
|
||||||
|
if publiee?
|
||||||
|
published_types_de_champ_public.filter(&:piece_justificative?)
|
||||||
|
else
|
||||||
|
draft_types_de_champ_public.filter(&:piece_justificative?)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def validate_auto_archive_on_in_the_future
|
def validate_auto_archive_on_in_the_future
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
%h2.fr-accordion__title
|
%h2.fr-accordion__title
|
||||||
%button.fr-accordion__btn{ "aria-controls" => "accordion-114", "aria-expanded" => "true" }
|
%button.fr-accordion__btn{ "aria-controls" => "accordion-114", "aria-expanded" => "true" }
|
||||||
= t('activerecord.attributes.procedure.description')
|
= t('activerecord.attributes.procedure.description')
|
||||||
#accordion-114.fr-collapse.js_description
|
#accordion-114.fr-collapse
|
||||||
= h render SimpleFormatComponent.new(procedure.description, allow_a: true)
|
= h render SimpleFormatComponent.new(procedure.description, allow_a: true)
|
||||||
|
|
||||||
- if procedure.description_target_audience.present?
|
- if procedure.description_target_audience.present?
|
||||||
|
@ -36,15 +36,26 @@
|
||||||
%h2.fr-accordion__title
|
%h2.fr-accordion__title
|
||||||
%button.fr-accordion__btn{ "aria-controls" => "accordion-115", "aria-expanded" => "false" }
|
%button.fr-accordion__btn{ "aria-controls" => "accordion-115", "aria-expanded" => "false" }
|
||||||
= t('activerecord.attributes.procedure.description_target_audience')
|
= t('activerecord.attributes.procedure.description_target_audience')
|
||||||
#accordion-115.fr-collapse.js_description_target_audience
|
#accordion-115.fr-collapse
|
||||||
= h render SimpleFormatComponent.new(procedure.description_target_audience, allow_a: true)
|
= h render SimpleFormatComponent.new(procedure.description_target_audience, allow_a: true)
|
||||||
|
|
||||||
|
- if procedure.pieces_jointes_list.present?
|
||||||
|
%section.fr-accordion.pieces_jointes
|
||||||
|
%h2.fr-accordion__title
|
||||||
|
%button.fr-accordion__btn{ "aria-controls" => "accordion-116", "aria-expanded" => "false" }
|
||||||
|
= t('shared.procedure_description.pieces_jointes')
|
||||||
|
#accordion-116.fr-collapse
|
||||||
|
%ul
|
||||||
|
- procedure.pieces_jointes_list.each do |pj|
|
||||||
|
%li
|
||||||
|
= pj.libelle
|
||||||
|
|
||||||
- if procedure.persisted? && procedure.estimated_duration_visible?
|
- if procedure.persisted? && procedure.estimated_duration_visible?
|
||||||
%section.fr-accordion
|
%section.fr-accordion
|
||||||
%h2.fr-accordion__title
|
%h2.fr-accordion__title
|
||||||
%button.fr-accordion__btn{ "aria-controls" => "accordion-116", "aria-expanded" => "false" }
|
%button.fr-accordion__btn{ "aria-controls" => "accordion-117", "aria-expanded" => "false" }
|
||||||
= t('shared.procedure_description.estimated_fill_duration_title')
|
= t('shared.procedure_description.estimated_fill_duration_title')
|
||||||
#accordion-116.fr-collapse.js_description_target_audience
|
#accordion-117.fr-collapse
|
||||||
= t('shared.procedure_description.estimated_fill_duration_detail', estimated_minutes: estimated_fill_duration_minutes(procedure))
|
= t('shared.procedure_description.estimated_fill_duration_detail', estimated_minutes: estimated_fill_duration_minutes(procedure))
|
||||||
|
|
||||||
- if procedure.notice.attached?
|
- if procedure.notice.attached?
|
||||||
|
|
|
@ -823,3 +823,4 @@ en:
|
||||||
estimated_fill_duration: "Estimated fill time: %{estimated_minutes} mn"
|
estimated_fill_duration: "Estimated fill time: %{estimated_minutes} mn"
|
||||||
estimated_fill_duration_title: What is the procedure estimated fill time ?
|
estimated_fill_duration_title: What is the procedure estimated fill time ?
|
||||||
estimated_fill_duration_detail: "The fill time is etimated to %{estimated_minutes} min. This period may vary depending on the options you choose"
|
estimated_fill_duration_detail: "The fill time is etimated to %{estimated_minutes} min. This period may vary depending on the options you choose"
|
||||||
|
pieces_jointes : What are the required attachments ?
|
||||||
|
|
|
@ -869,3 +869,4 @@ fr:
|
||||||
estimated_fill_duration: "Temps de remplissage estimé : %{estimated_minutes} mn"
|
estimated_fill_duration: "Temps de remplissage estimé : %{estimated_minutes} mn"
|
||||||
estimated_fill_duration_title: Quelle est la durée de remplissage de la démarche ?
|
estimated_fill_duration_title: Quelle est la durée de remplissage de la démarche ?
|
||||||
estimated_fill_duration_detail: "La durée de remplissage est estimée à %{estimated_minutes} min. Ce délai peut varier selon les options que vous choisirez."
|
estimated_fill_duration_detail: "La durée de remplissage est estimée à %{estimated_minutes} min. Ce délai peut varier selon les options que vous choisirez."
|
||||||
|
pieces_jointes : Quelles sont les pièces justificatives à fournir ?
|
||||||
|
|
|
@ -10,6 +10,7 @@ describe 'shared/_procedure_description', type: :view do
|
||||||
expect(rendered).to have_text(procedure.libelle)
|
expect(rendered).to have_text(procedure.libelle)
|
||||||
expect(rendered).to have_text(procedure.description)
|
expect(rendered).to have_text(procedure.description)
|
||||||
expect(rendered).to have_text('Temps de remplissage estimé')
|
expect(rendered).to have_text('Temps de remplissage estimé')
|
||||||
|
expect(rendered).not_to have_text('Quelles sont les pièces justificatives à fournir')
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'procedure with estimated duration not visible' do
|
context 'procedure with estimated duration not visible' do
|
||||||
|
@ -32,4 +33,22 @@ describe 'shared/_procedure_description', type: :view do
|
||||||
expect(rendered).to have_text('Date limite')
|
expect(rendered).to have_text('Date limite')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when the procedure has pieces jointes' do
|
||||||
|
let(:procedure) { create(:procedure, :draft, :with_titre_identite, :with_piece_justificative, :with_siret) }
|
||||||
|
it 'shows the pieces jointes list for draft procedure' do
|
||||||
|
subject
|
||||||
|
expect(rendered).to have_text('Quelles sont les pièces justificatives à fournir')
|
||||||
|
expect(rendered).to have_text('Libelle du champ')
|
||||||
|
expect(rendered).to have_selector('.pieces_jointes ul li', count: 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shows the pieces jointes list for published procedure' do
|
||||||
|
procedure.publish!
|
||||||
|
subject
|
||||||
|
expect(rendered).to have_text('Quelles sont les pièces justificatives à fournir')
|
||||||
|
expect(rendered).to have_text('Libelle du champ')
|
||||||
|
expect(rendered).to have_selector('.pieces_jointes ul li', count: 2)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue