module Refinery::Pages

Public Class Methods

default_parts_for(page) click to toggle source
# File 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_paths() click to toggle source
# File lib/refinery/pages.rb, line 23
def factory_paths
  @factory_paths ||= [ root.join('spec', 'factories').to_s ]
end
layout_template_whitelist() click to toggle source
# File lib/refinery/pages/configuration.rb, line 39
def layout_template_whitelist
  Array(config.layout_template_whitelist).map(&:to_s)
end
root() click to toggle source
# File lib/refinery/pages.rb, line 19
def root
  @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
end
tabs() click to toggle source
# File lib/refinery/pages/tab.rb, line 4
def self.tabs
  @tabs ||= []
end
tabs_for_template(template) click to toggle source
# 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) click to toggle source
# File 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_attributes() click to toggle source
# File lib/refinery/pages/configuration.rb, line 35
def whitelist_attributes
  Loofah::HTML5::WhiteList::ALLOWED_ATTRIBUTES.merge(config.add_whitelist_attributes)
end
whitelist_elements() click to toggle source
# File lib/refinery/pages/configuration.rb, line 31
def whitelist_elements
  Loofah::HTML5::WhiteList::ALLOWED_ELEMENTS.merge(config.add_whitelist_elements)
end