Class: NumericRangeFilterInput

Inherits:
ActiveAdminAddons::InputBase show all
Includes:
ActiveAdminAddons::FilterInput
Defined in:
app/inputs/numeric_range_filter_input.rb

Direct Known Subclasses

RangeSelectInput

Instance Method Summary collapse

Methods included from ActiveAdminAddons::FilterInputMethods

#eq_input_name, #gteq_input_name, #input_value, #lteq_input_name, #object_class

Methods included from ActiveAdminAddons::InputMethods

#association_name, #build_virtual_attr, #input_association_value, #input_related_items, #input_value, #method_model, #model_name, #object_class, #tableize_method, #translated_method, #url_from_method, #valid_method, #valid_object

Methods inherited from ActiveAdminAddons::InputBase

#concat, #load_control_attributes, #load_input_class, #parts, #parts_to_html, #to_html

Methods included from ActiveAdminAddons::InputHtmlHelpers

#build_hidden_control, #build_separator, #empty_input_id, #method_to_input_array_name, #method_to_input_id, #method_to_input_name, #prefixed_method, #selected_values_id

Methods included from ActiveAdminAddons::InputOptionsHandler

#attr_options, #control_attributes, #css_classes, #data_attr_options, #get_data_attr_value, #load_attr, #load_class, #load_data_attr

Instance Method Details

#concat_text_field(control_name) ⇒ Object



11
12
13
# File 'app/inputs/numeric_range_filter_input.rb', line 11

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

#input_html_options(input_name = gteq_input_name) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'app/inputs/numeric_range_filter_input.rb', line 17

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

#render_custom_inputObject



4
5
6
7
8
9
# File 'app/inputs/numeric_range_filter_input.rb', line 4

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