Module: Refinery::Pages

Includes:
ActiveSupport::Configurable
Defined in:
lib/refinery/pages.rb,
lib/refinery/pages/tab.rb,
lib/refinery/pages/type.rb,
lib/refinery/pages/types.rb,
lib/refinery/pages/engine.rb,
lib/refinery/pages/configuration.rb,
lib/refinery/pages/instance_methods.rb,
lib/refinery/pages/content_presenter.rb,
lib/refinery/pages/section_presenter.rb,
lib/refinery/pages/admin/instance_methods.rb,
lib/refinery/pages/content_page_presenter.rb,
lib/refinery/pages/title_section_presenter.rb,
lib/refinery/pages/page_part_section_presenter.rb,
app/helpers/refinery/pages/content_pages_helper.rb

Defined Under Namespace

Modules: Admin, ContentPagesHelper, InstanceMethods Classes: ContentPagePresenter, ContentPresenter, Engine, PagePartSectionPresenter, SectionPresenter, Tab, TitleSectionPresenter, Type, Types

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#tabsObject

Returns the value of attribute tabs.



4
5
6
# File 'lib/refinery/pages/tab.rb', line 4

def tabs
  @tabs
end

Class Method Details

.default_parts_for(page) ⇒ Object



38
39
40
41
42
# File 'lib/refinery/pages.rb', line 38

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

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

.factory_pathsObject



22
23
24
# File 'lib/refinery/pages.rb', line 22

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

.rootObject



18
19
20
# File 'lib/refinery/pages.rb', line 18

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

.tabsObject



6
7
8
# File 'lib/refinery/pages/tab.rb', line 6

def self.tabs
  @tabs ||= []
end

.valid_templates(*pattern) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/refinery/pages.rb', line 26

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