feat(shared/_piece_justificative_template): forward traduction for better naming of download title element

Co-Authored-By: Corinne Durrmeyer <corinne@inseo.fr>
This commit is contained in:
mfo 2024-10-30 09:50:59 +01:00
parent f72c55631c
commit 54c9e46df0
No known key found for this signature in database
GPG key ID: 7CE3E1F5B794A8EC
2 changed files with 4 additions and 3 deletions

View file

@ -9,7 +9,7 @@ class Dsfr::DownloadComponent < ApplicationComponent
attr_reader :new_tab
attr_reader :truncate
def initialize(attachment:, name: nil, url: nil, ephemeral_link: false, virus_not_analyzed: false, new_tab: false, truncate: false)
def initialize(attachment:, name: nil, url: nil, ephemeral_link: false, virus_not_analyzed: false, new_tab: false, truncate: false, title: nil)
@attachment = attachment
@name = name || attachment.filename.to_s
@url = url
@ -17,10 +17,11 @@ class Dsfr::DownloadComponent < ApplicationComponent
@virus_not_analyzed = virus_not_analyzed
@new_tab = new_tab
@truncate = truncate
@title = title
end
def title
t(".title", filename: attachment.filename.to_s)
@title || t(".title", filename: attachment.filename.to_s)
end
def url

View file

@ -1 +1 @@
= render Dsfr::DownloadComponent.new(attachment: champ.type_de_champ.piece_justificative_template, url: champs_piece_justificative_template_path(champ.dossier, champ.stable_id, row_id: champ.row_id), name: t('views.shared.piece_justificative.name'), ephemeral_link: administrateur_signed_in? )
= render Dsfr::DownloadComponent.new(attachment: champ.type_de_champ.piece_justificative_template, url: champs_piece_justificative_template_path(champ.dossier, champ.stable_id, row_id: champ.row_id), name: t('views.shared.piece_justificative.name'), ephemeral_link: administrateur_signed_in?, title: t('views.shared.piece_justificative.title', filename: champ.type_de_champ.piece_justificative_template.blob.filename.to_s) )