mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-15 21:56:12 +08:00
16 lines
452 B
Ruby
16 lines
452 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
Dir.chdir(Rails.root.join('app/views/reports/templates')) do
|
||
|
templates = Dir.glob('*').select { |entry| File.directory?(entry) }
|
||
|
templates.each do |template|
|
||
|
next if Extends::REPORT_TEMPLATES[template.to_sym].present?
|
||
|
|
||
|
Extends::REPORT_TEMPLATES[template.to_sym] =
|
||
|
if File.file?("#{template}/name.txt")
|
||
|
File.open("#{template}/name.txt").read.strip
|
||
|
else
|
||
|
template
|
||
|
end
|
||
|
end
|
||
|
end
|