Module: MobileWorkflow::Displayable::Steps::Form

Defined in:
app/models/concerns/mobile_workflow/displayable/steps/form.rb

Instance Method Summary collapse

Instance Method Details

#mw_form_date(label:, id:, optional: false, default_text_answer: nil) ⇒ Object



46
47
48
49
50
51
52
# File 'app/models/concerns/mobile_workflow/displayable/steps/form.rb', line 46

def mw_form_date(label:, id:, optional: false, default_text_answer: nil)
  raise 'Missing label' if label.nil?
  raise 'Missing id' if id.nil?

  { item_type: :date, date_type: :calendar, id: id, label: label, optional: optional,
    default_text_answer: default_text_answer }
end

#mw_form_email(label:, id:, placeholder: nil, optional: false, default_text_answer: nil) ⇒ Object



62
63
64
65
66
67
68
# File 'app/models/concerns/mobile_workflow/displayable/steps/form.rb', line 62

def mw_form_email(label:, id:, placeholder: nil, optional: false, default_text_answer: nil)
  raise 'Missing label' if label.nil?
  raise 'Missing id' if id.nil?

  { item_type: :email, id: id, label: label, placeholder: placeholder,
    optional: optional, default_text_answer: default_text_answer }
end

#mw_form_multiple_selection(label:, multiple_selection_options:, id:, selection_type: :single, optional: false, show_other_option: false) ⇒ Object



15
16
17
18
19
20
21
22
# File 'app/models/concerns/mobile_workflow/displayable/steps/form.rb', line 15

def mw_form_multiple_selection(label:, multiple_selection_options:, id:, selection_type: :single, optional: false, show_other_option: false)
  raise 'Missing label' if label.nil?
  raise 'Missing id' if id.nil?
  raise 'Missing multiple selection options' if multiple_selection_options.nil?

  { item_type: :multiple_selection, id: id, label: label,
    multiple_selection_options: multiple_selection_options, selection_type: selection_type, optional: optional, show_other_option: show_other_option }
end

#mw_form_multiple_selection_options(text:, hint: nil, is_pre_selected: false) ⇒ Object



24
25
26
27
28
# File 'app/models/concerns/mobile_workflow/displayable/steps/form.rb', line 24

def mw_form_multiple_selection_options(text:, hint: nil, is_pre_selected: false)
  raise 'Missing text' if text.nil?

  { text: text, hint: hint, isPreSelected: is_pre_selected }
end

#mw_form_number(label:, id:, placeholder: nil, optional: false, symbol_position: :leading, default_text_answer: nil, hint: nil) ⇒ Object



30
31
32
33
34
35
36
# File 'app/models/concerns/mobile_workflow/displayable/steps/form.rb', line 30

def mw_form_number(label:, id:, placeholder: nil, optional: false, symbol_position: :leading, default_text_answer: nil, hint: nil)
  raise 'Missing label' if label.nil?
  raise 'Missing id' if id.nil?

  { item_type: :number, number_type: :number, id: id, label: label,
    placeholder: placeholder, optional: optional, symbol_position: symbol_position, default_text_answer: default_text_answer, hint: hint }
end

#mw_form_password(label:, id:, placeholder: nil, optional: false, default_text_answer: nil, hint: nil) ⇒ Object



70
71
72
73
74
75
76
# File 'app/models/concerns/mobile_workflow/displayable/steps/form.rb', line 70

def mw_form_password(label:, id:, placeholder: nil, optional: false, default_text_answer: nil, hint: nil)
  raise 'Missing label' if label.nil?
  raise 'Missing id' if id.nil?

  { item_type: :secure, id: id, label: label, placeholder: placeholder,
    optional: optional, default_text_answer: default_text_answer, hint: hint }
end

#mw_form_section(label:, id:) ⇒ Object



8
9
10
11
12
13
# File 'app/models/concerns/mobile_workflow/displayable/steps/form.rb', line 8

def mw_form_section(label:, id:)
  raise 'Missing label' if label.nil?
  raise 'Missing id' if id.nil?

  { item_type: :section, id: id, label: label }
end

#mw_form_text(label:, id:, placeholder: nil, optional: false, multiline: false, default_text_answer: nil, hint: nil) ⇒ Object



38
39
40
41
42
43
44
# File 'app/models/concerns/mobile_workflow/displayable/steps/form.rb', line 38

def mw_form_text(label:, id:, placeholder: nil, optional: false, multiline: false, default_text_answer: nil, hint: nil)
  raise 'Missing label' if label.nil?
  raise 'Missing id' if id.nil?

  { item_type: :text, id: id, label: label, placeholder: placeholder,
    optional: optional, multiline: multiline, default_text_answer: default_text_answer, hint: hint }
end

#mw_form_time(label:, id:, optional: false, default_text_answer: nil) ⇒ Object



54
55
56
57
58
59
60
# File 'app/models/concerns/mobile_workflow/displayable/steps/form.rb', line 54

def mw_form_time(label:, id:, optional: false, default_text_answer: nil)
  raise 'Missing label' if label.nil?
  raise 'Missing id' if id.nil?

  { item_type: :time, id: id, label: label, optional: optional,
    default_text_answer: default_text_answer }
end