Module: AppRail::Steps::CoreForms::Form

Included in:
Displayable
Defined in:
lib/app_rail/steps/core_forms/form.rb

Instance Method Summary collapse

Instance Method Details

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



49
50
51
52
53
54
55
# File 'lib/app_rail/steps/core_forms/form.rb', line 49

def ar_core_forms_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

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



65
66
67
68
69
70
71
# File 'lib/app_rail/steps/core_forms/form.rb', line 65

def ar_core_forms_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

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



18
19
20
21
22
23
24
25
# File 'lib/app_rail/steps/core_forms/form.rb', line 18

def ar_core_forms_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

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



27
28
29
30
31
# File 'lib/app_rail/steps/core_forms/form.rb', line 27

def ar_core_forms_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

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



33
34
35
36
37
38
39
# File 'lib/app_rail/steps/core_forms/form.rb', line 33

def ar_core_forms_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

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



73
74
75
76
77
78
79
# File 'lib/app_rail/steps/core_forms/form.rb', line 73

def ar_core_forms_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

#ar_core_forms_form_section(label:, id:) ⇒ Object

MBS - Note - ID on forms should be the value on the customOutput in the app.json for this field



11
12
13
14
15
16
# File 'lib/app_rail/steps/core_forms/form.rb', line 11

def ar_core_forms_form_section(label:, id:)
  raise "Missing label" if label.nil?
  raise "Missing id" if id.nil?

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

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



41
42
43
44
45
46
47
# File 'lib/app_rail/steps/core_forms/form.rb', line 41

def ar_core_forms_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

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



57
58
59
60
61
62
63
# File 'lib/app_rail/steps/core_forms/form.rb', line 57

def ar_core_forms_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