Merge pull request #9121 from demarches-simplifiees/add-detail-on-PJ-on-description-procedure-page
[Refonte page accueil demarche] Ajouter les infos concernant les PJ
This commit is contained in:
commit
f4e33c068b
5 changed files with 63 additions and 4 deletions
|
@ -966,6 +966,18 @@ class Procedure < ApplicationRecord
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def pieces_jointes_list?
|
||||||
|
pieces_jointes_list_without_conditionnal.present? || pieces_jointes_list_with_conditionnal.present?
|
||||||
|
end
|
||||||
|
|
||||||
|
def pieces_jointes_list_without_conditionnal
|
||||||
|
active_revision.types_de_champ_public.not_condition.filter(&:piece_justificative?)
|
||||||
|
end
|
||||||
|
|
||||||
|
def pieces_jointes_list_with_conditionnal
|
||||||
|
active_revision.types_de_champ_public.where.not(condition: nil).filter(&:piece_justificative?)
|
||||||
|
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,37 @@
|
||||||
%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?
|
||||||
|
%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
|
||||||
|
- if procedure.pieces_jointes_list_without_conditionnal.present?
|
||||||
|
%ul
|
||||||
|
- procedure.pieces_jointes_list_without_conditionnal.each do |pj|
|
||||||
|
%li
|
||||||
|
= pj.libelle
|
||||||
|
= t('utils.no_mandatory') if !pj.mandatory?
|
||||||
|
|
||||||
|
- if procedure.pieces_jointes_list_with_conditionnal.present?
|
||||||
|
%h3.fr-text--sm.fr-mb-0.fr-mt-2w
|
||||||
|
= t('shared.procedure_description.pieces_jointes_conditionnal_list_title')
|
||||||
|
%ul
|
||||||
|
- procedure.pieces_jointes_list_with_conditionnal.each do |pj|
|
||||||
|
%li
|
||||||
|
= pj.libelle
|
||||||
|
= t('utils.no_mandatory') if !pj.mandatory?
|
||||||
|
|
||||||
- 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?
|
||||||
|
|
|
@ -51,6 +51,7 @@ en:
|
||||||
pj: "Attachments"
|
pj: "Attachments"
|
||||||
asterisk_html: Fields marked by an asterisk ( <span class = mandatory>*</span> ) are mandatory.
|
asterisk_html: Fields marked by an asterisk ( <span class = mandatory>*</span> ) are mandatory.
|
||||||
mandatory_champs: All fields are mandatory.
|
mandatory_champs: All fields are mandatory.
|
||||||
|
no_mandatory: (optional)
|
||||||
file_number: File number
|
file_number: File number
|
||||||
subject: Subject
|
subject: Subject
|
||||||
message: Message
|
message: Message
|
||||||
|
@ -823,3 +824,5 @@ 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 ?
|
||||||
|
pieces_jointes_conditionnal_list_title : Attachments list according to your situation
|
||||||
|
|
|
@ -42,6 +42,7 @@ fr:
|
||||||
pj: "Pièces jointes"
|
pj: "Pièces jointes"
|
||||||
asterisk_html: Les champs suivis d’un astérisque ( * ) sont obligatoires.
|
asterisk_html: Les champs suivis d’un astérisque ( * ) sont obligatoires.
|
||||||
mandatory_champs: Tous les champs sont obligatoires.
|
mandatory_champs: Tous les champs sont obligatoires.
|
||||||
|
no_mandatory: (facultatif)
|
||||||
file_number: Numéro de dossier
|
file_number: Numéro de dossier
|
||||||
subject: Sujet
|
subject: Sujet
|
||||||
message: Message
|
message: Message
|
||||||
|
@ -869,3 +870,5 @@ 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 ?
|
||||||
|
pieces_jointes_conditionnal_list_title : Liste des pièces en fonction de votre situation
|
||||||
|
|
|
@ -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