Class: Rails::Brochure::HomeContent
- Inherits:
-
Object
- Object
- Rails::Brochure::HomeContent
- Defined in:
- lib/rails-brochure/home_content.rb
Constant Summary collapse
- @@home_folder_path =
This feature needs more work. You can change the folder path and the routes are correct Rails::Brochure::HomeContent.home_folder_path = ‘app/views/content/’ but the home controller looks in the home folder anyway… So the home controller would need to use a different directory. If I wanted to make this configurable i’d probably ask for a controller name, define one (meta) and render the routes accordingly.
'app/views/home/'
Class Method Summary collapse
Class Method Details
.files ⇒ Object
18 19 20 |
# File 'lib/rails-brochure/home_content.rb', line 18 def self.files Dir.glob("#{home_folder_path}**/*.html.*") end |
.newest ⇒ Object
15 16 17 |
# File 'lib/rails-brochure/home_content.rb', line 15 def self.newest HomeContent.files.map { |f| File.new(f) }.sort { |a,b| a.ctime <=> b.ctime }.map { |f| f.ctime }.last end |
.templates ⇒ Object
21 22 23 24 25 |
# File 'lib/rails-brochure/home_content.rb', line 21 def self.templates HomeContent.files.map do |f| f.gsub(/(#{home_folder_path}|.html.\w+)/,"") end end |