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, Phone, RadioGroup, Rating, Select, StripeExternalAccount, StripeToken, Submit, Text, TimeZone
Instance Attribute Summary
#json, #page
Instance Method Summary
collapse
#initialize, #props
Instance Method Details
#created ⇒ Object
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 48
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
19
20
21
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 19
def hint(hint)
@hint = hint
end
|
#hint_args(hint_args) ⇒ Object
23
24
25
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 23
def hint_args(hint_args)
@hint_args = hint_args
end
|
#label(label) ⇒ Object
11
12
13
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 11
def label(label)
@label = label
end
|
#label_args(label_args) ⇒ Object
15
16
17
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 15
def label_args(label_args)
@label_args = label_args
end
|
#name(name) ⇒ Object
35
36
37
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 35
def name(name)
@name = name if name != Glib::Value::DEFAULT
end
|
#placeholder(placeholder) ⇒ Object
27
28
29
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 27
def placeholder(placeholder)
@placeholder = placeholder
end
|
#placeholder_args(placeholder_args) ⇒ Object
31
32
33
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 31
def placeholder_args(placeholder_args)
@placeholder_args = placeholder_args
end
|
#prop(prop) ⇒ Object
43
44
45
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 43
def prop(prop)
@prop = prop
end
|
#value(value) ⇒ Object
39
40
41
|
# File 'app/helpers/glib/json_ui/view_builder/fields.rb', line 39
def value(value)
@value = value if value != Glib::Value::DEFAULT
end
|