Class: DateTimePickerFilterInput

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

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, #input_html_options, #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_date_time_picker_field(control_name) ⇒ Object



14
15
16
# File 'app/inputs/date_time_picker_filter_input.rb', line 14

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

#date_time_picker_options(input_name = gteq_input_name) ⇒ Object



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

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

#load_control_attributesObject



4
5
6
# File 'app/inputs/date_time_picker_filter_input.rb', line 4

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

#render_custom_inputObject



8
9
10
11
12
# File 'app/inputs/date_time_picker_filter_input.rb', line 8

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