Sha256: 14607d9b7cda35be8914a34d4350836b34a6f7d7949f9fa8db99851dbeaf40db

Contents?: true

Size: 804 Bytes

Versions: 25

Compression:

Stored size: 804 Bytes

Contents

module ActiveAdmin
  module Inputs
    class FilterDateRangeInput

      def to_html
        input_wrapping do
          [ label_html,
            builder.text_field(gt_input_name, input_html_options(gt_input_name, 'datepickergte')),
            template.content_tag(:span, "-", :class => "seperator"),
            builder.text_field(lt_input_name, input_html_options(lt_input_name, 'datepickerlte')),
          ].join("\n").html_safe
        end
      end

      def input_html_options(input_name = gt_input_name, extra_class = '')
        current_value = @object.send(input_name)
        { :size => 12,
          :class => "datepicker #{extra_class}",
          :max => 10,
          :value => current_value.respond_to?(:strftime) ? current_value.strftime("%Y-%m-%d") : "" }
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 1 rubygems

Version Path
smartkiosk-server-0.10.0 lib/active_admin/inputs/filter_date_range_input_fix.rb
smartkiosk-server-0.9.3 lib/active_admin/inputs/filter_date_range_input_fix.rb
smartkiosk-server-0.9.2 lib/active_admin/inputs/filter_date_range_input_fix.rb
smartkiosk-server-0.9.1 lib/active_admin/inputs/filter_date_range_input_fix.rb
smartkiosk-server-0.9.0 lib/active_admin/inputs/filter_date_range_input_fix.rb