Class: SearchSelectInput

Inherits:
ActiveAdminAddons::InputBase show all
Includes:
ActiveAdminAddons::SelectHelpers
Defined in:
app/inputs/search_select_input.rb

Direct Known Subclasses

SearchSelectFilterInput

Instance Method Summary collapse

Methods included from ActiveAdminAddons::SelectHelpers

#active_record_select?, #array_to_select_options, #collection_to_select_options, #initial_collection_to_select_options, #item_to_select_option, #selected_collection, #selected_item

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

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

Instance Method Details

#input_methodObject



10
11
12
# File 'app/inputs/search_select_input.rb', line 10

def input_method
  valid_method
end

#load_control_attributesObject



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/inputs/search_select_input.rb', line 14

def load_control_attributes
  load_class(@options[:class])
  load_data_attr(:fields, default: ["name"], formatter: :to_json)
  load_data_attr(:predicate, default: "contains")
  load_data_attr(:url, default: url_from_method)
  load_data_attr(:response_root, default: tableize_method)
  load_data_attr(:display_name, default: "name")
  load_data_attr(:minimum_input_length, default: 1)
  load_data_attr(:width, default: "80%")
  load_data_attr(
    :order,
    value: @options[:order_by],
    default: get_data_attr_value(:fields).first.to_s + "_desc"
  )
end

#render_custom_inputObject



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

def render_custom_input
  concat(label_html)
  concat(builder.select(input_method,
    initial_collection_to_select_options, {}, input_html_options))
end