Module: Beef::Pages::HelperMethods

Defined in:
lib/pages.rb

Instance Method Summary collapse

Instance Method Details

#get_template_namesObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/pages.rb', line 4

def get_template_names
  templates = []
  
  # get all files that would be useable templates from the templates folder
  # templates that start with an underscore are considered hidden
  Dir.glob("#{RAILS_ROOT}/app/views/pages/templates/*") do |f| 
    match = /\/([^_][^\/]+)\.html\.erb$/.match(f)
    templates << match[1] unless match.nil?
  end
  # Move default to top if it exists
  if default = templates.delete('default')
    templates.insert(0, default)
  end
  templates
end