Sha256: d97dbb11d79df1878ce4f8aee0a09d99012f297c4e86049317f17e3ab4fd7b06
Contents?: true
Size: 1.07 KB
Versions: 1
Compression:
Stored size: 1.07 KB
Contents
module SimpleForm module Inputs class DateTimePickerInput < Base def input(wrapper_options = nil) @builder.datetime_field(attribute_name, input_html_options) end private def input_html_options if options.key?(:input_html) && options[:input_html].key?(:value) value = options[:input_html][:value] elsif options.key? :value value = options[:value] elsif object.respond_to?(attribute_name) value = object.send(attribute_name) else value = '' end value = Time.zone.parse(value) if value.is_a?(String) value = value.strftime("%Y-%m-%d %H:%M") if value.respond_to?(:strftime) result = { class: 'form-control text-center datetime datetimepicker', value: value.presence || '' } if options.key? :input_html result[:class] += ' ' + options[:input_html][:class] if options[:input_html][:class].present? result.merge(options[:input_html].except(:class, :value)) else result end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
simple_form_bootstrap3-0.3.6 | lib/simple_form/inputs/date_time_picker_input.rb |