Module: Refinery::Pages

Includes:
ActiveSupport::Configurable
Defined in:
lib/refinery/pages.rb,
lib/refinery/pages/tab.rb,
lib/refinery/pages/url.rb,
lib/refinery/pages/type.rb,
lib/refinery/pages/types.rb,
lib/refinery/pages/engine.rb,
lib/refinery/pages/caching.rb,
lib/refinery/pages/configuration.rb,
lib/refinery/pages/render_options.rb,
lib/refinery/pages/instance_methods.rb,
app/sweepers/refinery/pages/page_sweeper.rb,
lib/refinery/pages/admin/instance_methods.rb,
app/presenters/refinery/pages/menu_presenter.rb,
app/helpers/refinery/pages/content_pages_helper.rb,
app/presenters/refinery/pages/content_presenter.rb,
app/presenters/refinery/pages/section_presenter.rb,
app/presenters/refinery/pages/content_page_presenter.rb,
app/presenters/refinery/pages/title_section_presenter.rb,
app/controllers/refinery/pages/admin/preview_controller.rb,
app/presenters/refinery/pages/page_part_section_presenter.rb

Defined Under Namespace

Modules: Admin, ContentPagesHelper, InstanceMethods, RenderOptions Classes: Caching, ContentPagePresenter, ContentPresenter, Engine, MenuPresenter, PagePartSectionPresenter, PageSweeper, SectionPresenter, Tab, TitleSectionPresenter, Type, Types, Url

Class Method Summary collapse

Class Method Details

.default_parts_for(page) ⇒ Object



34
35
36
37
38
# File 'lib/refinery/pages.rb', line 34

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

.layout_template_whitelistObject



25
26
27
# File 'lib/refinery/pages/configuration.rb', line 25

def layout_template_whitelist
  Array(config.layout_template_whitelist).map(&: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



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

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

.tabs_for_template(template) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/refinery/pages/tab.rb', line 8

def self.tabs_for_template(template)
  return tabs unless template

  tabs.select do |tab|
    tab.templates.include?('all') || tab.templates.include?(template)
  end
end

.valid_templates(*pattern) ⇒ Object



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

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