Sha256: 53ba0d8cbfe7bbe2cb62192b4d0d311db8f00db642dd2dca2d470a09a63aa9e0

Contents?: true

Size: 792 Bytes

Versions: 5

Compression:

Stored size: 792 Bytes

Contents

module Beef
  module Pages
    module HelperMethods
      def get_template_names
        templates = []
        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

5 entries across 5 versions & 1 rubygems

Version Path
beef-pages-0.3.12 lib/pages.rb
beef-pages-0.3.11 lib/pages.rb
beef-pages-0.3.10 lib/pages.rb
beef-pages-0.3.9 lib/pages.rb
beef-pages-0.3.8 lib/pages.rb