Class: TagsInput

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

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

#load_control_attributesObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/inputs/tags_input.rb', line 12

def load_control_attributes
  load_data_attr(:model, value: model_name)
  load_data_attr(:method, value: method)
  load_data_attr(:width, default: "80%")

  if active_record_select?
    load_data_attr(:relation, value: true)
    load_data_attr(:collection, value: collection_to_select_options, formatter: :to_json)
  else
    load_data_attr(:collection, value: array_to_select_options, formatter: :to_json)
  end
end

#render_custom_inputObject



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

def render_custom_input
  if active_record_select?
    return render_collection_tags
  end

  render_array_tags
end