Class: Decidim::CustomUserFields::Fields::GenericField
- Inherits:
-
Object
- Object
- Decidim::CustomUserFields::Fields::GenericField
show all
- Extended by:
- Forwardable
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- lib/decidim/custom_user_fields/fields/generic_field.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(definition, options) ⇒ GenericField
Returns a new instance of GenericField.
11
12
13
14
|
# File 'lib/decidim/custom_user_fields/fields/generic_field.rb', line 11
def initialize(definition, options)
@definition = definition
@options = options
end
|
Instance Attribute Details
#definition ⇒ Object
Returns the value of attribute definition.
10
11
12
|
# File 'lib/decidim/custom_user_fields/fields/generic_field.rb', line 10
def definition
@definition
end
|
#options ⇒ Object
Returns the value of attribute options.
10
11
12
|
# File 'lib/decidim/custom_user_fields/fields/generic_field.rb', line 10
def options
@options
end
|
Instance Method Details
#class_name ⇒ Object
28
29
30
31
|
# File 'lib/decidim/custom_user_fields/fields/generic_field.rb', line 28
def class_name
class_specifier = name.to_s.underscore
"field field--#{type} field--#{class_specifier}"
end
|
16
17
18
|
# File 'lib/decidim/custom_user_fields/fields/generic_field.rb', line 16
def configure_form(_form)
raise Error, "Configure Form is not implemented for #{definition.type} type"
end
|
24
25
26
|
# File 'lib/decidim/custom_user_fields/fields/generic_field.rb', line 24
def form_tag(_form)
raise Error, "Form Tag is not implemented for #{definition.type} type"
end
|
#map_model(_form, _model_data) ⇒ Object
20
21
22
|
# File 'lib/decidim/custom_user_fields/fields/generic_field.rb', line 20
def map_model(_form, _model_data)
raise Error, "Map Model is not implemented for #{definition.type} type"
end
|
#required? ⇒ Boolean
33
34
35
|
# File 'lib/decidim/custom_user_fields/fields/generic_field.rb', line 33
def required?
options[:required].present? && options[:required]
end
|