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'
|
@procedure.routing_enabled? ? 'groupes' : 'instructeurs'
|
||||||
end
|
end
|
||||||
|
|
||||||
def template_url
|
def template_file
|
||||||
if @procedure.routing_enabled?
|
if @procedure.routing_enabled?
|
||||||
'/csv/import-groupe-test.csv'
|
'/csv/import-groupe-test.csv'
|
||||||
else
|
else
|
||||||
|
@ -32,10 +32,6 @@ class Procedure::ImportComponent < ApplicationComponent
|
||||||
end
|
end
|
||||||
|
|
||||||
def template_path
|
def template_path
|
||||||
if @procedure.routing_enabled?
|
Rails.public_path.join(template_file.delete_prefix('/'))
|
||||||
Rails.public_path.join('csv/import-groupe-test.csv')
|
|
||||||
else
|
|
||||||
Rails.public_path.join('csv/import-instructeurs-test.csv')
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
%label.fr-label.font-weight-bold
|
%label.fr-label.font-weight-bold
|
||||||
= t('.csv_import.file_to_import')
|
= t('.csv_import.file_to_import')
|
||||||
.fr-download
|
.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')
|
= t('.csv_import.download_template')
|
||||||
%span.fr-download__detail
|
%span.fr-download__detail
|
||||||
= template_detail
|
= template_detail
|
||||||
|
|
Loading…
Add table
Reference in a new issue