457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
|
# File 'app/models/article.rb', line 457
def self.article_types_for_select
results = []
path_to_articletypes = File.join(::Rails.root, "app", "views", "articletypes")
if Dir.exist?(path_to_articletypes)
Dir.foreach(path_to_articletypes) do |name|
file_name_path = File.join(path_to_articletypes,name)
if File.directory?(file_name_path)
Dir.foreach(file_name_path) do |sub_name|
file_name = "#{name}#{sub_name}" if File.exist?(File.join(file_name_path,sub_name)) && (sub_name =~ /^_(?!edit).*/) == 0
results << file_name.split(".").first.to_s.titleize if file_name.present?
end
end
end
end
return results
end
|