Sha256: 612071ea697185d36867ac87d3a8b12811456e8d9e29812b1c984c4a79747776

Contents?: true

Size: 1.38 KB

Versions: 3

Compression:

Stored size: 1.38 KB

Contents

require 'refinerycms-core'

module Refinery
  autoload :PagesGenerator, 'generators/refinery/pages/pages_generator'

  module Pages
    require 'refinery/pages/engine'
    require 'refinery/pages/tab'
    require 'refinery/pages/type'
    require 'refinery/pages/types'

    # Load configuration last so that everything above is available to it.
    require 'refinery/pages/configuration'

    autoload :InstanceMethods, 'refinery/pages/instance_methods'

    class << self
      def root
        @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
      end

      def factory_paths
        @factory_paths ||= [ root.join('spec', 'factories').to_s ]
      end

      def valid_templates(*pattern)
        [Rails.root, Refinery::Plugins.registered.pathnames].flatten.uniq.map { |p|
          p.join(*pattern)
        }.map(&:to_s).map { |p|
          Dir[p]
        }.select(&:any?).flatten.map { |f|
          File.basename(f)
        }.map { |p|
          p.split('.').first
        }
      end

      def default_parts_for(page)
        return default_parts unless page.view_template.present?

        types.find_by_name(page.view_template).parts.map &:titleize
      end
    end

    module Admin
      autoload :InstanceMethods, 'refinery/pages/admin/instance_methods'
    end
  end
end

require 'awesome_nested_set'
require 'globalize3'
require 'friendly_id'
require 'seo_meta'
require 'babosa'

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
refinerycms-pages-2.0.2 lib/refinery/pages.rb
refinerycms-pages-2.0.1 lib/refinery/pages.rb
refinerycms-pages-2.0.0 lib/refinery/pages.rb