Module: MotionPrime::ScreenSectionsMixin

Extended by:
MotionSupport::Concern
Includes:
HasClassFactory, HasNormalizer
Included in:
ScreenBaseMixin
Defined in:
motion-prime/screens/_sections_mixin.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from HasNormalizer

#debug_info, #element?, #normalize_object, #normalize_options, #normalize_value

Methods included from HasClassFactory

#camelize_factory, #class_factory, #low_camelize_factory, #underscore_factory

Instance Attribute Details

#_action_section_optionsObject

Returns the value of attribute _action_section_options.



12
13
14
# File 'motion-prime/screens/_sections_mixin.rb', line 12

def _action_section_options
  @_action_section_options
end

Class Method Details

.included(base) ⇒ Object



8
9
10
# File 'motion-prime/screens/_sections_mixin.rb', line 8

def self.included(base)
  base.class_attribute :_section_options
end

Instance Method Details

#all_sectionsObject



22
23
24
# File 'motion-prime/screens/_sections_mixin.rb', line 22

def all_sections
  Array.wrap(@sections.try(:values))
end

#all_sections_with_mainObject



26
27
28
# File 'motion-prime/screens/_sections_mixin.rb', line 26

def all_sections_with_main
  (all_sections + [main_section]).compact.uniq
end

#main_sectionObject



14
15
16
# File 'motion-prime/screens/_sections_mixin.rb', line 14

def main_section
  @main_section || all_sections.first
end

#main_section=(value) ⇒ Object



18
19
20
# File 'motion-prime/screens/_sections_mixin.rb', line 18

def main_section=(value)
  @main_section = value
end

#refreshObject



40
41
42
# File 'motion-prime/screens/_sections_mixin.rb', line 40

def refresh
  all_sections_with_main.each { |s| s.try(:reload) }
end

#set_section(name, options = {}) ⇒ Object Also known as: section



30
31
32
33
# File 'motion-prime/screens/_sections_mixin.rb', line 30

def set_section(name, options = {})
  self._action_section_options ||= {}
  self._action_section_options[name.to_sym] = options
end

#set_sections_wrapper(value) ⇒ Object



36
37
38
# File 'motion-prime/screens/_sections_mixin.rb', line 36

def set_sections_wrapper(value)
  self.class.set_sections_wrapper(value)
end