Sha256: 73e695f758746ed739c8bd79e1b08dd8c3828c264d15b1c8a90ed9a3cf1646dc

Contents?: true

Size: 462 Bytes

Versions: 9

Compression:

Stored size: 462 Bytes

Contents

class SearchSelectInput < Formtastic::Inputs::StringInput
  def input_html_options
    relation = @object.send(attributized_method_name)
    opts = {}
    opts[:class] = "select2-ajax"
    opts["data-fields"] = (@options[:fields] || []).to_json
    opts["data-url"] = @options[:url] || ""
    opts["data-display_name"] = @options[:display_name] || "name"
    opts["data-selected"] = relation.try(opts["data-display_name"].to_sym)
    super.merge opts
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activeadmin_addons-0.2.7 app/inputs/search_select_input.rb
activeadmin_addons-0.2.6 app/inputs/search_select_input.rb
activeadmin_addons-0.2.5 app/inputs/search_select_input.rb
activeadmin_addons-0.2.4 app/inputs/search_select_input.rb
activeadmin_addons-0.2.3 app/inputs/search_select_input.rb
activeadmin_addons-0.2.2 app/inputs/search_select_input.rb
activeadmin_addons-0.2.1 app/inputs/search_select_input.rb
activeadmin_addons-0.2.0 app/inputs/search_select_input.rb
activeadmin_addons-0.1.0 app/inputs/search_select_input.rb