Class: ProMotion::XLSubFormScreen

Inherits:
XLFormScreen show all
Defined in:
lib/ProMotion/XLForm/xl_sub_form_screen.rb

Instance Attribute Summary collapse

Attributes inherited from XLFormScreen

#form_object

Instance Method Summary collapse

Methods inherited from XLFormScreen

#add_cell, #add_section, #button_config, #cell_at_path, #cell_with_tag, #dismiss_keyboard, #display_errors, #enabled=, #enabled?, #reload, #remove_cell!, #remove_section!, #section_with_tag, #valid?, #value_for_cell, #values, #viewDidLoad

Methods included from XLFormModule

included

Methods inherited from XlFormViewController

#class_handles_delegates?, #didRotateFromInterfaceOrientation, #init, #loadView, new, #shouldAutorotate, #shouldAutorotateToInterfaceOrientation, #viewDidAppear, #viewDidDisappear, #viewDidLoad, #viewWillAppear, #viewWillDisappear, #willRotateToInterfaceOrientation

Instance Attribute Details

#rowDescriptorObject

Returns the value of attribute rowDescriptor.



3
4
5
# File 'lib/ProMotion/XLForm/xl_sub_form_screen.rb', line 3

def rowDescriptor
  @rowDescriptor
end

Instance Method Details

#form_dataObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/ProMotion/XLForm/xl_sub_form_screen.rb', line 5

def form_data
  [
    {
      title: rowDescriptor.title,
      cells: rowDescriptor.action.cells.map do |cell|
        tag = cell[:name]
        if tag.respond_to? :to_s
          tag = tag.to_s
        end
        if rowDescriptor && rowDescriptor.value && rowDescriptor.value[tag]
          cell.merge({ value: rowDescriptor.value[tag] })
        else
          cell
        end
      end
    }
  ]
end

#formRowDescriptorValueHasChanged(row, oldValue: old_value, newValue: new_value) ⇒ Object

XLFormDescriptorDelegate



38
39
40
41
# File 'lib/ProMotion/XLForm/xl_sub_form_screen.rb', line 38

def formRowDescriptorValueHasChanged(row, oldValue: old_value, newValue: new_value)
  super
  rowDescriptor.value = values
end

#update_form_dataObject



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ProMotion/XLForm/xl_sub_form_screen.rb', line 24

def update_form_data
  title = rowDescriptor.title
  required = rowDescriptor.action.required

  @form_builder = PM::XLForm.new(self.form_data,
                                 {
                                   title: title,
                                   required: required
                                 })
  @form_object = @form_builder.build
  self.form = @form_object
end