Sha256: 963fd59093d332c97767def7629f8d9095912bf716b4414013151b51e9797466

Contents?: true

Size: 677 Bytes

Versions: 23

Compression:

Stored size: 677 Bytes

Contents

class NumericRangeFilterInput < ActiveAdminAddons::InputBase
  include ActiveAdminAddons::FilterInput

  def render_custom_input
    concat(label_html)
    concat_text_field(gteq_input_name)
    concat(build_separator)
    concat_text_field(lteq_input_name)
  end

  def concat_text_field(control_name)
    concat(builder.text_field(control_name, input_html_options(control_name)))
  end

  alias :input_name :gteq_input_name

  def input_html_options(input_name = gteq_input_name)
    is_gt = (input_name == gteq_input_name)

    {
      type: "number",
      step: "any",
      value: @object.public_send(input_name),
      placeholder: is_gt ? "min" : "max"
    }
  end
end

Version data entries

23 entries across 23 versions & 2 rubygems

Version Path
activeadmin_addons-2.0.0.beta.4 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.10.2 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-2.0.0.beta.3 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.10.1 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-2.0.0.beta.2 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-2.0.0.beta.0 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.10.0 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.9.0 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.8.3 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.8.2 app/inputs/numeric_range_filter_input.rb
activeadmin_addons_rails6-1.7.2 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.7.1 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.7.0 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.6.0 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.5.0 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.4.0 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.3.0 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.2.0 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.1.2 app/inputs/numeric_range_filter_input.rb
activeadmin_addons-1.1.1 app/inputs/numeric_range_filter_input.rb