refactor(import component): remove path duplication

This commit is contained in:
Eric Leroy-Terquem 2024-10-14 14:52:44 +02:00
parent 60be8d68fc
commit b75f2125de
No known key found for this signature in database
GPG key ID: 53D8FAECEF207605
2 changed files with 3 additions and 7 deletions

View file

@ -9,7 +9,7 @@ class Procedure::ImportComponent < ApplicationComponent
@procedure.routing_enabled? ? 'groupes' : 'instructeurs'
end
def template_url
def template_file
if @procedure.routing_enabled?
'/csv/import-groupe-test.csv'
else
@ -32,10 +32,6 @@ class Procedure::ImportComponent < ApplicationComponent
end
def template_path
if @procedure.routing_enabled?
Rails.public_path.join('csv/import-groupe-test.csv')
else
Rails.public_path.join('csv/import-instructeurs-test.csv')
end
Rails.public_path.join(template_file.delete_prefix('/'))
end
end

View file

@ -12,7 +12,7 @@
%label.fr-label.font-weight-bold
= t('.csv_import.file_to_import')
.fr-download
= link_to template_url, {class: "fr-download__link", download: ''} do
= link_to template_file, {class: "fr-download__link", download: ''} do
= t('.csv_import.download_template')
%span.fr-download__detail
= template_detail