Module: MotionPrime::ScreenBaseMixin
- Extended by:
- MotionSupport::Concern
- Includes:
- ScreenAliasesMixin, ScreenNavigationMixin, ScreenOrientationsMixin, ScreenSectionsMixin, MotionSupport::Callbacks
- Defined in:
- motion-prime/screens/_base_mixin.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#main_section ⇒ Object
Returns the value of attribute main_section.
-
#modal ⇒ Object
Returns the value of attribute modal.
-
#options ⇒ Object
Returns the value of attribute options.
-
#params ⇒ Object
Returns the value of attribute params.
-
#parent_screen ⇒ Object
Returns the value of attribute parent_screen.
-
#tab_bar ⇒ Object
Returns the value of attribute tab_bar.
Instance Method Summary collapse
- #app_delegate ⇒ Object
- #main_controller ⇒ Object
- #modal? ⇒ Boolean
-
#on_create(options = {}) ⇒ MotionPrime::Screen
Setup the screen, this method will be called when you run MPViewController.new.
- #refresh ⇒ Object
- #title ⇒ Object
- #title=(new_title) ⇒ Object
Methods included from ScreenSectionsMixin
#add_sections, #create_section, #create_sections, included, #render_sections
Methods included from HasNormalizer
#normalize_object, #normalize_options
Methods included from HasClassFactory
#camelize_factory, #class_factory, #low_camelize_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
#main_section ⇒ Object
Returns the value of attribute main_section.
15 16 17 |
# File 'motion-prime/screens/_base_mixin.rb', line 15 def main_section @main_section end |
#modal ⇒ Object
Returns the value of attribute modal.
15 16 17 |
# File 'motion-prime/screens/_base_mixin.rb', line 15 def modal @modal end |
#options ⇒ Object
Returns the value of attribute options.
15 16 17 |
# File 'motion-prime/screens/_base_mixin.rb', line 15 def @options end |
#params ⇒ Object
Returns the value of attribute params.
15 16 17 |
# File 'motion-prime/screens/_base_mixin.rb', line 15 def params @params end |
#parent_screen ⇒ Object
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_bar ⇒ Object
Returns the value of attribute tab_bar.
15 16 17 |
# File 'motion-prime/screens/_base_mixin.rb', line 15 def @tab_bar end |
Instance Method Details
#app_delegate ⇒ Object
18 19 20 |
# File 'motion-prime/screens/_base_mixin.rb', line 18 def app_delegate UIApplication.sharedApplication.delegate end |
#main_controller ⇒ Object
56 57 58 |
# File 'motion-prime/screens/_base_mixin.rb', line 56 def main_controller ? : self end |
#modal? ⇒ Boolean
42 43 44 |
# File 'motion-prime/screens/_base_mixin.rb', line 42 def modal? !!self.modal end |
#on_create(options = {}) ⇒ MotionPrime::Screen
Setup the screen, this method will be called when you run MPViewController.new
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'motion-prime/screens/_base_mixin.rb', line 29 def on_create( = {}) unless self.is_a?(UIViewController) raise StandardError.new("ERROR: Screens must extend UIViewController.") end self. = self.params = [:params] || {} .each do |k, v| self.send("#{k}=", v) if self.respond_to?("#{k}=") end self end |
#refresh ⇒ Object
60 61 62 |
# File 'motion-prime/screens/_base_mixin.rb', line 60 def refresh main_section.try(:reload_data) end |
#title ⇒ Object
46 47 48 49 50 |
# File 'motion-prime/screens/_base_mixin.rb', line 46 def title title = self.class.title title = self.instance_eval(&title) if title.is_a?(Proc) title end |
#title=(new_title) ⇒ Object
52 53 54 |
# File 'motion-prime/screens/_base_mixin.rb', line 52 def title=(new_title) self.class.title(new_title) end |