Class: Decidim::CustomUserFields::Fields::DateField
- Inherits:
-
GenericField
- Object
- GenericField
- Decidim::CustomUserFields::Fields::DateField
show all
- Defined in:
- lib/decidim/custom_user_fields/fields/date_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/date_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
21
22
23
24
25
26
|
# File 'lib/decidim/custom_user_fields/fields/date_field.rb', line 14
def form_tag(form_tag)
field_options = {}
if options[:min].present? || options[:max].present?
field_options[:min] = options[:min] if options[:min].present?
field_options[:max] = options[:max] if options[:max].present?
end
content_tag(
:div,
form_tag.date_field(name, **field_options),
class: class_name
)
end
|
#map_model(form, data) ⇒ Object
10
11
12
|
# File 'lib/decidim/custom_user_fields/fields/date_field.rb', line 10
def map_model(form, data)
form[name] = data[name] if data[name].present?
end
|