Class: Formatic::Base
Overview
All inputs inherit from this class.
Instance Method Summary
collapse
#initialize
Instance Method Details
#data ⇒ Object
69
70
71
|
# File 'app/components/formatic/base.rb', line 69
def data
manual_data
end
|
83
84
85
|
# File 'app/components/formatic/base.rb', line 83
def input_name
"#{param_key}[#{attribute_name}]#{'[]' if multiple}"
end
|
#param_key ⇒ Object
Name of the URL param for this record.
78
79
80
|
# File 'app/components/formatic/base.rb', line 78
def param_key
f.object.model_name.param_key
end
|
#value ⇒ Object
63
64
65
66
67
|
# File 'app/components/formatic/base.rb', line 63
def value
return manual_value if manual_value != :_fetch_from_record
f.object.public_send(attribute_name) if f.object.respond_to?(attribute_name)
end
|
#wrapper ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
61
|
# File 'app/components/formatic/base.rb', line 50
def wrapper
@wrapper ||= ::Formatic::Wrapper.new(
f:,
attribute_name:,
label:,
hint:,
required:,
prevent_submit_on_enter:,
label_for_id:,
class: wrapper_class
)
end
|