Allow set id for select2 element
This commit is contained in:
parent
880e047fb4
commit
589a18d821
@ -1,9 +1,10 @@
|
||||
module AdditionalsSelect2Helper
|
||||
def additionals_select2_tag(name, option_tags = nil, options = {})
|
||||
s = select_tag(name, option_tags, options)
|
||||
id = options.delete(:id) || sanitize_to_id(name)
|
||||
s << hidden_field_tag("#{name}[]", '') if options[:multiple] && options.fetch(:include_hidden, true)
|
||||
|
||||
s + javascript_tag("select2Tag('#{sanitize_to_id name}', #{options.to_json});")
|
||||
s + javascript_tag("select2Tag('#{id}', #{options.to_json});")
|
||||
end
|
||||
|
||||
# Transforms select filters of +type+ fields into select2
|
||||
|
Loading…
Reference in New Issue
Block a user