diff --git a/app/components/dsfr/download_component.rb b/app/components/dsfr/download_component.rb index 02697b5f1..b576c843e 100644 --- a/app/components/dsfr/download_component.rb +++ b/app/components/dsfr/download_component.rb @@ -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 diff --git a/app/views/shared/_piece_justificative_template.html.haml b/app/views/shared/_piece_justificative_template.html.haml index 9dbc8d2b7..6a6c0226f 100644 --- a/app/views/shared/_piece_justificative_template.html.haml +++ b/app/views/shared/_piece_justificative_template.html.haml @@ -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) )