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/finder.rb,
lib/refinery/pages/configuration.rb,
lib/refinery/pages/render_options.rb,
lib/refinery/pages/instance_methods.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: ContentPagePresenter, ContentPresenter, Engine, Finder, FinderByPath, FinderByPathOrId, FinderByScopedPath, FinderBySlug, FinderByTitle, FinderByUnscopedPath, MenuPresenter, PagePartSectionPresenter, SectionPresenter, Tab, TitleSectionPresenter, Type, Types, Url
Class Method Summary
collapse
Class Method Details
.default_parts ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'lib/refinery/pages/configuration.rb', line 42
def default_parts
if config.default_parts.all? { |v| v.is_a? String }
new_syntax = config.default_parts.map do |part|
{ title: part, slug: part.downcase.gsub(" ", "_") }
end
Refinery.deprecate(
"Change Refinery::Pages.default_parts= from #{config.default_parts.inspect} to #{new_syntax.inspect}",
when: "3.2.0"
)
new_syntax
else
config.default_parts
end
end
|
.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_paths ⇒ Object
22
23
24
|
# File 'lib/refinery/pages.rb', line 22
def factory_paths
@factory_paths ||= [ root.join('spec', 'factories').to_s ]
end
|
.layout_template_whitelist ⇒ Object
38
39
40
|
# File 'lib/refinery/pages/configuration.rb', line 38
def layout_template_whitelist
Array(config.layout_template_whitelist).map(&:to_s)
end
|
.root ⇒ Object
18
19
20
|
# File 'lib/refinery/pages.rb', line 18
def root
@root ||= Pathname.new(File.expand_path('../../../', __FILE__))
end
|
.tabs ⇒ Object
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 do |f|
File.basename(f).split('.').first
end
}.flatten.uniq
end
|
.whitelist_attributes ⇒ Object
34
35
36
|
# File 'lib/refinery/pages/configuration.rb', line 34
def whitelist_attributes
Loofah::HTML5::WhiteList::ALLOWED_ATTRIBUTES.merge(config.add_whitelist_attributes)
end
|
.whitelist_elements ⇒ Object
30
31
32
|
# File 'lib/refinery/pages/configuration.rb', line 30
def whitelist_elements
Loofah::HTML5::WhiteList::ALLOWED_ELEMENTS.merge(config.add_whitelist_elements)
end
|