Sha256: a3b389ae26fcbd2b593efb81e33b33e9941796a3e72d7704fc591622f0eafe42

Contents?: true

Size: 996 Bytes

Versions: 2

Compression:

Stored size: 996 Bytes

Contents

module Rails
  module Brochure
    class HomeContent
      # 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.
      @@home_folder_path = 'app/views/home/'
      cattr_accessor :home_folder_path

      def self.newest
        HomeContent.files.map { |f| File.new(f) }.sort { |a,b| a.ctime <=> b.ctime }.map { |f| f.ctime }.last
      end
      def self.files
        Dir.glob("#{home_folder_path}**/*.html.*")
      end
      def self.templates
        HomeContent.files.map do |f| 
          f.gsub(/(#{home_folder_path}|.html.\w+)/,"")
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails-brochure-0.0.6 lib/rails-brochure/home_content.rb
rails-brochure-0.0.5 lib/rails-brochure/home_content.rb