Class: Headmin::Form::ColorView
Instance Method Summary
collapse
Methods inherited from ViewModel
#attributes, #initialize, #to_hash
Constructor Details
This class inherits a constructor from ViewModel
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class ViewModel
Instance Method Details
9
10
11
12
13
|
# File 'app/models/headmin/form/color_view.rb', line 9
def input_options
keys = attributes - %i[attribute form label validate wrapper]
options = to_h.slice(*keys)
default_input_options.deep_merge(options)
end
|
#label_options ⇒ Object
15
16
17
18
19
20
21
22
23
|
# File 'app/models/headmin/form/color_view.rb', line 15
def label_options
{
class: ["form-label"],
attribute: attribute,
form: form,
required: required,
text: label
}
end
|
#value ⇒ Object
25
26
27
|
# File 'app/models/headmin/form/color_view.rb', line 25
def value
@form.object&.send(@attribute) || "#000000"
end
|
#wrapper_options ⇒ Object
29
30
31
32
33
|
# File 'app/models/headmin/form/color_view.rb', line 29
def wrapper_options
default_wrapper_options.deep_merge(
{}
).deep_merge(@wrapper || {})
end
|