class Maglev::PageComponent
def build_section(definition, attributes)
def build_section(definition, attributes) build( SectionComponent, parent: self, definition: definition, attributes: attributes.deep_transform_keys! { |k| k.to_s.underscore.to_sym }, templates_root_path: templates_root_path, rendering_mode: rendering_mode ) end
def initialize(site:, theme:, page:, page_sections:, context:)
def initialize(site:, theme:, page:, page_sections:, context:) @site = site @theme = theme @page = page @page_sections = page_sections @templates_root_path = context[:templates_root_path] @config = context[:config] @rendering_mode = context[:rendering_mode] end
def inspect_fields
def inspect_fields [['site_id', site.id], ['page_id', page.id], ['theme', theme.id]] end
def render
def render sections.collect(&:render).join end
def sections
def sections @sections ||= page_sections.map do |attributes| definition = theme.sections.find(attributes['type']) next unless definition build_section(definition, attributes) end.compact end