Module: MotionPrime::SectionWithContainerMixin

Extended by:
MotionSupport::Concern
Included in:
DrawSectionMixin
Defined in:
motion-prime/sections/_section_with_container_mixin.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#container_viewObject



9
10
11
# File 'motion-prime/sections/_section_with_container_mixin.rb', line 9

def container_view
  container_element.try(:view)
end

#init_container_element(options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'motion-prime/sections/_section_with_container_mixin.rb', line 13

def init_container_element(options = {})
  @container_element ||= begin
    options.merge!({
      screen: screen,
      section: self.weak_ref,
      has_drawn_content: true
    })
    container_element_options = self.class.container_element_options.clone
    options = (container_element_options || {}).deep_merge(options)
    type = options.delete(:type)
    MotionPrime::BaseElement.factory(type, options)
  end
end

#load_container_with_elements(options = {}) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'motion-prime/sections/_section_with_container_mixin.rb', line 27

def load_container_with_elements(options = {})
  init_container_element(options[:container] || {})
  @container_element.compute_options! unless @container_element.computed_options
  compute_element_options(options[:elements] || {})

  if respond_to?(:prerender_elements_for_state) && prerender_enabled?
    prerender_elements_for_state(:normal)
  end
end