Module: HakumiComponents::Concerns::InputControl
Instance Method Summary
collapse
Methods included from FormField
#describedby_ids, #error?, #error_message, #form_field_caption, #form_field_contract, #form_field_errors, #form_field_html_options, #form_field_label, #form_field_name, #form_field_required, #form_field_rules, #form_field_standalone, #form_item_attributes, #form_item_classes, #input_id, #render_caption, #render_error, #render_explain, #render_label, #standalone?
#form_field_contract
Instance Method Details
16
17
18
19
20
21
|
# File 'app/components/hakumi_components/concerns/input_control.rb', line 16
def input_control_contract
contract = T.let(@input_control_contract, T.nilable(InputControlContract))
return contract unless contract.nil?
Kernel.raise "input_control_contract must be initialized"
end
|
39
40
41
|
# File 'app/components/hakumi_components/concerns/input_control.rb', line 39
def input_control_disabled
input_control_contract.disabled
end
|
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
# File 'app/components/hakumi_components/concerns/input_control.rb', line 49
def input_control_has_value?
value = input_control_value
if value.is_a?(Array)
return value.any? do |item|
next false if item.nil? || item == false
next !item.empty? if item.is_a?(String)
true
end
end
return false if value.nil? || value == false
return !value.empty? if value.is_a?(String)
true
end
|
29
30
31
|
# File 'app/components/hakumi_components/concerns/input_control.rb', line 29
def input_control_placeholder
input_control_contract.placeholder
end
|
44
45
46
|
# File 'app/components/hakumi_components/concerns/input_control.rb', line 44
def input_control_readonly
input_control_contract.readonly
end
|
34
35
36
|
# File 'app/components/hakumi_components/concerns/input_control.rb', line 34
def input_control_size
input_control_contract.size
end
|
24
25
26
|
# File 'app/components/hakumi_components/concerns/input_control.rb', line 24
def input_control_value
input_control_contract.value
end
|