Sha256: 42d628c8eddcba0642482521748e0658716ff8e7e5d75d08c75cb2989e27d4f2

Contents?: true

Size: 958 Bytes

Versions: 14

Compression:

Stored size: 958 Bytes

Contents

module Beef
  module Pages
    module HelperMethods
      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
    end
    
    module UrlHelper
      def page_path(page, options = {})
        permalink = page.is_a?( Page ) ? page.permalink : page.to_s
        page_permalink_path(permalink,options)
      end
    
      def page_url(page, options = {}) 
        page_path(page, options.merge(:only_path => false)) 
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
beef-pages-0.3.26 lib/pages.rb
beef-pages-0.3.25 lib/pages.rb
beef-pages-0.3.24 lib/pages.rb
beef-pages-0.3.23 lib/pages.rb
beef-pages-0.3.22 lib/pages.rb
beef-pages-0.3.21 lib/pages.rb
beef-pages-0.3.20 lib/pages.rb
beef-pages-0.3.19 lib/pages.rb
beef-pages-0.3.18 lib/pages.rb
beef-pages-0.3.17 lib/pages.rb
beef-pages-0.3.16 lib/pages.rb
beef-pages-0.3.15 lib/pages.rb
beef-pages-0.3.14 lib/pages.rb
beef-pages-0.3.13 lib/pages.rb