Class: Formatic::Wrapper
Overview
Instance Method Summary
collapse
#initialize
Instance Method Details
#error? ⇒ Boolean
53
54
55
|
# File 'app/components/formatic/wrapper.rb', line 53
def error?
error_messages.present?
end
|
#error_messages ⇒ Object
69
70
71
72
73
74
|
# File 'app/components/formatic/wrapper.rb', line 69
def error_messages
@error_messages ||= ::Formatic::Wrappers::ErrorMessages.call(
object:,
attribute_name:
)
end
|
#hint ⇒ Object
89
90
91
92
93
94
95
96
97
98
|
# File 'app/components/formatic/wrapper.rb', line 89
def hint
return manual_hint if manual_hint != true && manual_hint != false
@hint ||= ::Formatic::Wrappers::Translate.call(
prefix: :'helpers.hint',
object:,
attribute_name:,
object_name: f&.object_name
)
end
|
#hint? ⇒ Boolean
Whether to display a hint or not.
49
50
51
|
# File 'app/components/formatic/wrapper.rb', line 49
def hint?
manual_hint != false
end
|
65
66
67
|
# File 'app/components/formatic/wrapper.rb', line 65
def hint_before_input?
manual_hint == :before_input
end
|
#label? ⇒ Boolean
Whether to display a label or not.
44
45
46
|
# File 'app/components/formatic/wrapper.rb', line 44
def label?
manual_label != false
end
|
#optional? ⇒ Boolean
61
62
63
|
# File 'app/components/formatic/wrapper.rb', line 61
def optional?
!required?
end
|
#placeholder ⇒ Object
80
81
82
83
84
85
86
87
|
# File 'app/components/formatic/wrapper.rb', line 80
def placeholder
@placeholder ||= ::Formatic::Wrappers::Translate.call(
prefix: :'helpers.placeholder',
object:,
attribute_name:,
object_name: f&.object_name
)
end
|
#required? ⇒ Boolean
57
58
59
|
# File 'app/components/formatic/wrapper.rb', line 57
def required?
@required ||= ::Formatic::Wrappers::Required.call(manual_required:, object:, attribute_name:)
end
|
#toggle_off ⇒ Object
109
110
111
112
113
114
115
116
|
# File 'app/components/formatic/wrapper.rb', line 109
def toggle_off
@toggle_off ||= ::Formatic::Wrappers::Translate.call(
prefix: :'helpers.hint',
object:,
attribute_name: :"#{attribute_name}_inactive",
object_name: f&.object_name
)
end
|
#toggle_on ⇒ Object
100
101
102
103
104
105
106
107
|
# File 'app/components/formatic/wrapper.rb', line 100
def toggle_on
@toggle_on ||= ::Formatic::Wrappers::Translate.call(
prefix: :'helpers.hint',
object:,
attribute_name: :"#{attribute_name}_active",
object_name: f&.object_name
)
end
|