refactor(import component): remove path duplication
This commit is contained in:
parent
60be8d68fc
commit
b75f2125de
2 changed files with 3 additions and 7 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue