Class: Glib::JsonUi::ViewBuilder::Fields::AbstractField
- Inherits:
-
View
show all
- Defined in:
- app/helpers/glib/json_ui/view_builder/fields.rb
Direct Known Subclasses
Autocomplete, CheckGroup, Country, CreditCard, Date, Datetime, DynamicGroup, DynamicSelect, Location, RadioGroup, Select, StripeToken, Submit, Text
Instance Attribute Summary
#json, #page
Instance Method Summary
collapse
#initialize, #props
Instance Method Details
#created ⇒ Object
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 46
def created
if @prop && (form = page.current_form)
form.field_assert_respond_to(@prop)
@name ||= form.field_name(@prop, @multiple || false)
@value ||= form.field_value(@prop)
@label ||= form.field_label(@prop, @label_args || {})
@hint ||= form.hint_label(@prop, @hint_args || {})
@placeholder ||= form.placeholder_label(@prop, @placeholder_args || {})
@validation ||= form.field_validation(@prop)
end
json.name @name
json.value @value if @value
json.label @label if @label
json.hint @hint if @hint
json.placeholder @placeholder if @placeholder
end
|
#hint(hint) ⇒ Object
17
18
19
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 17
def hint(hint)
@hint = hint
end
|
#hint_args(hint_args) ⇒ Object
21
22
23
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 21
def hint_args(hint_args)
@hint_args = hint_args
end
|
#label(label) ⇒ Object
9
10
11
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 9
def label(label)
@label = label
end
|
#label_args(label_args) ⇒ Object
13
14
15
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 13
def label_args(label_args)
@label_args = label_args
end
|
#name(name) ⇒ Object
33
34
35
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 33
def name(name)
@name = name if name != Glib::Value::DEFAULT
end
|
#placeholder(placeholder) ⇒ Object
25
26
27
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 25
def placeholder(placeholder)
@placeholder = placeholder
end
|
#placeholder_args(placeholder_args) ⇒ Object
29
30
31
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 29
def placeholder_args(placeholder_args)
@placeholder_args = placeholder_args
end
|
#prop(prop) ⇒ Object
41
42
43
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 41
def prop(prop)
@prop = prop
end
|
#value(value) ⇒ Object
37
38
39
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 37
def value(value)
@value = value if value != Glib::Value::DEFAULT
end
|