Class: ProMotion::FormScreen

Inherits:
FormViewController show all
Includes:
FormScreenStyle, ScreenModule
Defined in:
lib/ProMotion/form/form_screen.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from FormScreenStyle

#style, #style!, #style?

Methods inherited from FormViewController

#didRotateFromInterfaceOrientation, #loadView, new, #shouldAutorotate, #shouldAutorotateToInterfaceOrientation, #viewDidAppear, #viewDidDisappear, #viewWillAppear, #viewWillDisappear, #willRotateToInterfaceOrientation

Instance Attribute Details

#form_objectObject (readonly)

Returns the value of attribute form_object.



6
7
8
# File 'lib/ProMotion/form/form_screen.rb', line 6

def form_object
  @form_object
end

Instance Method Details

#dismiss_keyboardObject



25
26
27
# File 'lib/ProMotion/form/form_screen.rb', line 25

def dismiss_keyboard
  self.view.endEditing true
end

#form_dataObject



13
14
15
16
# File 'lib/ProMotion/form/form_screen.rb', line 13

def form_data
  PM.logger.info "You need to implement a `form_data` method in #{self.class.to_s}."
  []
end

#render_formObject



29
30
31
# File 'lib/ProMotion/form/form_screen.rb', line 29

def render_form
  Hash[form_object.each_pair.to_a].tap{|h| h.delete(:fields) }
end

#update_form_dataObject



18
19
20
21
22
23
# File 'lib/ProMotion/form/form_screen.rb', line 18

def update_form_data
  @form_object = PM::Form.new(self.form_data).build
  self.formController.form = @form_object
  self.formController.delegate = self
  self.view.reloadData
end

#viewDidLoadObject



8
9
10
11
# File 'lib/ProMotion/form/form_screen.rb', line 8

def viewDidLoad
  super
  update_form_data
end