mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-12-27 10:14:17 +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
|