Class: Decidim::CustomUserFields::Fields::TextField
- Inherits:
-
GenericField
- Object
- GenericField
- Decidim::CustomUserFields::Fields::TextField
show all
- Defined in:
- lib/decidim/custom_user_fields/fields/text_field.rb
Instance Attribute Summary
Attributes inherited from GenericField
#definition, #options
Instance Method Summary
collapse
#class_name, #initialize, #required?
Instance Method Details
5
6
7
8
|
# File 'lib/decidim/custom_user_fields/fields/text_field.rb', line 5
def configure_form(form)
form.attribute(name, String)
form.validates(name, presence: required?)
end
|
14
15
16
17
18
19
20
|
# File 'lib/decidim/custom_user_fields/fields/text_field.rb', line 14
def form_tag(form_tag)
content_tag(
:div,
form_tag.text_field(name),
class: class_name
)
end
|
#map_model(form, data) ⇒ Object
10
11
12
|
# File 'lib/decidim/custom_user_fields/fields/text_field.rb', line 10
def map_model(form, data)
form[name] = data[name] if data[name].present?
end
|