Module: Refinery::Pages

Includes:
ActiveSupport::Configurable
Defined in:
pages/lib/refinery/pages.rb,
pages/lib/refinery/pages/tab.rb,
pages/lib/refinery/pages/url.rb,
pages/lib/refinery/pages/type.rb,
pages/lib/refinery/pages/types.rb,
pages/lib/refinery/pages/engine.rb,
pages/lib/refinery/pages/finder.rb,
pages/lib/refinery/pages/configuration.rb,
pages/spec/lib/refinery/pages/tab_spec.rb,
pages/spec/lib/refinery/pages/url_spec.rb,
pages/lib/refinery/pages/render_options.rb,
pages/spec/lib/refinery/pages/type_spec.rb,
pages/lib/refinery/pages/instance_methods.rb,
pages/lib/refinery/pages/admin/instance_methods.rb,
pages/app/presenters/refinery/pages/menu_presenter.rb,
pages/app/helpers/refinery/pages/content_pages_helper.rb,
pages/app/presenters/refinery/pages/content_presenter.rb,
pages/app/presenters/refinery/pages/section_presenter.rb,
pages/spec/presenters/refinery/pages/menu_presenter_spec.rb,
pages/app/presenters/refinery/pages/content_page_presenter.rb,
pages/app/presenters/refinery/pages/title_section_presenter.rb,
pages/spec/helpers/refinery/pages/content_pages_helper_spec.rb,
pages/spec/presenters/refinery/pages/content_presenter_spec.rb,
pages/spec/presenters/refinery/pages/section_presenter_spec.rb,
pages/app/controllers/refinery/pages/admin/preview_controller.rb,
pages/app/presenters/refinery/pages/page_part_section_presenter.rb,
pages/spec/presenters/refinery/pages/content_page_presenter_spec.rb,
pages/spec/presenters/refinery/pages/title_section_presenter_spec.rb,
pages/spec/presenters/refinery/pages/page_part_section_presenter_spec.rb

Defined Under Namespace

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

Class Method Summary collapse

Class Method Details

.default_parts_for(page) ⇒ Object



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

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

  types.find_by_name(page.view_template).parts
end

.factory_pathsObject



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

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

.layout_template_whitelistObject



41
42
43
# File 'pages/lib/refinery/pages/configuration.rb', line 41

def layout_template_whitelist
  Array(config.layout_template_whitelist).map(&:to_s)
end

.rootObject



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

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

.tabsObject



4
5
6
# File 'pages/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 'pages/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



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

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

.whitelist_attributesObject



37
38
39
# File 'pages/lib/refinery/pages/configuration.rb', line 37

def whitelist_attributes
  Loofah::HTML5::SafeList::ALLOWED_ATTRIBUTES.merge(config.add_whitelist_attributes)
end

.whitelist_elementsObject



33
34
35
# File 'pages/lib/refinery/pages/configuration.rb', line 33

def whitelist_elements
  Loofah::HTML5::SafeList::ALLOWED_ELEMENTS.merge(config.add_whitelist_elements)
end