Sha256: 80a303c6021083abf0126f65eb89ffc5500647322b11334333be20a74b3df9d1

Contents?: true

Size: 703 Bytes

Versions: 8

Compression:

Stored size: 703 Bytes

Contents

class DateTimePickerFilterInput < ActiveAdminAddons::InputBase
  include ActiveAdminAddons::FilterInput

  def load_control_attributes
    load_attr(:picker_options, default: {})
  end

  def render_custom_input
    concat(label_html)
    concat_date_time_picker_field(gteq_input_name)
    concat_date_time_picker_field(lteq_input_name)
  end

  def concat_date_time_picker_field(control_name)
    concat(builder.input(control_name, date_time_picker_options(control_name)))
  end

  def date_time_picker_options(input_name = gteq_input_name)
    is_gt = (input_name == gteq_input_name)

    input_html_options.merge(
      as: :date_time_picker,
      placeholder: is_gt ? "min" : "max"
    )
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
activeadmin_addons-2.0.0.beta.3 app/inputs/date_time_picker_filter_input.rb
activeadmin_addons-1.10.1 app/inputs/date_time_picker_filter_input.rb
activeadmin_addons-2.0.0.beta.2 app/inputs/date_time_picker_filter_input.rb
activeadmin_addons-2.0.0.beta.0 app/inputs/date_time_picker_filter_input.rb
activeadmin_addons-1.10.0 app/inputs/date_time_picker_filter_input.rb
activeadmin_addons-1.9.0 app/inputs/date_time_picker_filter_input.rb
activeadmin_addons-1.8.3 app/inputs/date_time_picker_filter_input.rb
activeadmin_addons-1.8.2 app/inputs/date_time_picker_filter_input.rb