chore(titre_identite): render template if exists

This commit is contained in:
Colin Darie 2022-11-23 13:25:41 +01:00
parent 3e617f34ec
commit 920f90d2e3
3 changed files with 11 additions and 7 deletions

View file

@ -4,10 +4,4 @@
= render Attachment::MultipleComponent.new(champ: @champ, attached_file: @champ.piece_justificative_file, user_can_destroy:, user_can_download:, max:) do |c| = render Attachment::MultipleComponent.new(champ: @champ, attached_file: @champ.piece_justificative_file, user_can_destroy:, user_can_download:, max:) do |c|
- if @champ.type_de_champ.piece_justificative_template&.attached? - if @champ.type_de_champ.piece_justificative_template&.attached?
- c.with_template do - c.with_template do
= render Dsfr::DownloadComponent.new(attachment: @champ.type_de_champ.piece_justificative_template, name: "Modèle à télécharger") do |c| = render partial: "shared/piece_justificative_template", locals: { attachment: @champ.type_de_champ.piece_justificative_template }
- if helpers.administrateur_signed_in?
- c.with_right do
%span.fr-ml-2w.fr-text--xs.fr-text-mention--grey.visible-on-previous-hover
%span.fr-text-action-high--blue-france.fr-icon-questionnaire-line{ "aria-hidden": "true" }
= t('shared.ephemeral_link')

View file

@ -1,2 +1,5 @@
- user_can_destroy = !@champ.mandatory? || @champ.dossier.brouillon? - user_can_destroy = !@champ.mandatory? || @champ.dossier.brouillon?
- if @champ.type_de_champ.piece_justificative_template&.attached?
= render partial: "shared/piece_justificative_template", locals: { attachment: @champ.type_de_champ.piece_justificative_template }
= render Attachment::EditComponent.new(champ: @form.object, attached_file: @champ.piece_justificative_file, attachment: @champ.piece_justificative_file[0], user_can_destroy:) = render Attachment::EditComponent.new(champ: @form.object, attached_file: @champ.piece_justificative_file, attachment: @champ.piece_justificative_file[0], user_can_destroy:)

View file

@ -0,0 +1,7 @@
= render Dsfr::DownloadComponent.new(attachment: attachment, name: "Modèle à télécharger") do |c|
- if administrateur_signed_in?
- c.with_right do
%span.fr-ml-2w.fr-text--xs.fr-text-mention--grey.visible-on-previous-hover
%span.fr-text-action-high--blue-france.fr-icon-questionnaire-line{ "aria-hidden": "true" }
= t('shared.ephemeral_link')