app/helpers/adminpanel/adminpanel_form_builder.rb in adminpanel-2.6.0 vs app/helpers/adminpanel/adminpanel_form_builder.rb in adminpanel-2.6.1
- old
+ new
@@ -92,11 +92,11 @@
end
def enum_field(method, *args)
select(
method,
- self.object.class.send(method.pluralize).map{|option, value|
+ self.object.class.send(method.to_s.pluralize).map{|option, value|
[I18n.t("#{self.object.class.name.demodulize.downcase}.#{option}"), option]
},
*args
)
end
@@ -214,17 +214,18 @@
end
end
end
def datepickerize_base(method, options)
- options.reverse_merge! 'value' => Time.now.strftime("%d-%m-%Y")
+ options['data'] ||= {}
+ options['data']['date_format'] ||= 'dd-mm-yyyy'
+ options['data']['date'] ||= Time.now.strftime("%d-%m-%Y")
+ options['value'] = options['data']['date']
+
@template.content_tag(
:div,
class: 'input-append date datepicker datepicker-basic',
- data: {
- date_format: 'dd-mm-yyyy',
- date: options['value']
- }
+ data: options['data']
) do
text_field_original(method, options) +
(
@template.content_tag :span, class: 'add-on' do
@template.content_tag :i, nil, class: 'fa fa-th'