Class: ActiveAdmin::Inputs::FilterDateRangeInput

Inherits:
Object
  • Object
show all
Defined in:
lib/active_admin/inputs/filter_date_range_input_fix.rb

Instance Method Summary collapse

Instance Method Details

#input_html_options(input_name = gt_input_name, extra_class = '') ⇒ Object



15
16
17
18
19
20
21
# File 'lib/active_admin/inputs/filter_date_range_input_fix.rb', line 15

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("%d.%m.%Y") : "" }
end

#to_htmlObject



5
6
7
8
9
10
11
12
13
# File 'lib/active_admin/inputs/filter_date_range_input_fix.rb', line 5

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