Module: MotionPrime::ScreenBaseMixin

Extended by:
MotionSupport::Concern
Includes:
ScreenAliasesMixin, ScreenNavigationMixin, ScreenOrientationsMixin, ScreenSectionsMixin, MotionSupport::Callbacks
Included in:
Screen
Defined in:
motion-prime/screens/_base_mixin.rb

Defined Under Namespace

Modules: ClassMethods

Instance Attribute Summary collapse

Attributes included from ScreenSectionsMixin

#_action_section_options

Instance Method Summary collapse

Methods included from ScreenSectionsMixin

#all_sections, #all_sections_with_main, included, #main_section, #main_section=, #refresh, #set_section, #set_sections_wrapper

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

Methods included from ScreenNavigationMixin

#back, #close_screen, #has_navigation?, #navigation_controller, #navigation_controller=, #open_screen, #send_on_leave, #send_on_return, #wrap_in_navigation, #wrap_in_navigation?

Methods included from ScreenOrientationsMixin

#should_rotate, #supported_orientation?, #supported_orientations

Methods included from ScreenAliasesMixin

#on_appear, #on_disappear, #on_rotate, #should_autorotate, #view_did_appear, #view_did_disappear, #view_did_load, #view_will_appear, #view_will_disappear, #will_appear, #will_disappear, #will_rotate

Instance Attribute Details

#actionObject

Returns the value of attribute action.



15
16
17
# File 'motion-prime/screens/_base_mixin.rb', line 15

def action
  @action
end

Returns the value of attribute modal.



15
16
17
# File 'motion-prime/screens/_base_mixin.rb', line 15

def modal
  @modal
end

#optionsObject

Returns the value of attribute options.



15
16
17
# File 'motion-prime/screens/_base_mixin.rb', line 15

def options
  @options
end

#paramsObject

Returns the value of attribute params.



15
16
17
# File 'motion-prime/screens/_base_mixin.rb', line 15

def params
  @params
end

#parent_screenObject

Returns the value of attribute parent_screen.



15
16
17
# File 'motion-prime/screens/_base_mixin.rb', line 15

def parent_screen
  @parent_screen
end

#tab_barObject

Returns the value of attribute tab_bar.



15
16
17
# File 'motion-prime/screens/_base_mixin.rb', line 15

def tab_bar
  @tab_bar
end

Instance Method Details

#action?(action) ⇒ Boolean

Returns:

  • (Boolean)


42
43
44
# File 'motion-prime/screens/_base_mixin.rb', line 42

def action?(action)
  self.action == action.to_s
end

#app_delegateObject



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

def app_delegate
  UIApplication.sharedApplication.delegate
end

#content_controllerObject

Return content controller (without sidebar)



68
69
70
# File 'motion-prime/screens/_base_mixin.rb', line 68

def content_controller
  self
end

#main_controllerObject

Return the main controller.



63
64
65
# File 'motion-prime/screens/_base_mixin.rb', line 63

def main_controller
  has_navigation? ? navigation_controller : self
end

#modal?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'motion-prime/screens/_base_mixin.rb', line 46

def modal?
  !!self.modal
end

#on_create(options = {}) ⇒ MotionPrime::Screen

Setup the screen, this method will be called when you run MPViewController.new

Parameters:

  • options (hash) (defaults to: {})

    Options passed to setup

Returns:



29
30
31
32
33
34
35
36
37
38
39
40
# File 'motion-prime/screens/_base_mixin.rb', line 29

def on_create(options = {})
  unless self.is_a?(UIViewController)
    raise StandardError.new("ERROR: Screens must extend UIViewController.")
  end
  options[:action] ||= 'render'
  self.options = options
  self.params = options[:params] || {}
  options.each do |k, v|
    self.send("#{k}=", v) if self.respond_to?("#{k}=")
  end
  self
end

#titleObject



50
51
52
53
54
# File 'motion-prime/screens/_base_mixin.rb', line 50

def title
  title = self.class.title
  title = self.instance_eval(&title) if title.is_a?(Proc)
  title
end

#title=(new_title) ⇒ Object Also known as: set_title



56
57
58
59
# File 'motion-prime/screens/_base_mixin.rb', line 56

def title=(new_title)
  self.class.title(new_title)
  self.navigationItem.title = new_title
end