5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'lib/adminterface/extensions/filters/forms.rb', line 5
def active_admin_filters_form_for(search, filters, options = {})
options = defaults.deep_merge(options).deep_merge(required)
form_for search, options do |f|
filters.each do |attribute, opts|
next if opts.key?(:if) && !call_method_or_proc_on(self, opts[:if])
next if opts.key?(:unless) && call_method_or_proc_on(self, opts[:unless])
opts[:input_html] = instance_exec(&opts[:input_html]) if opts[:input_html].is_a?(Proc)
f.filter attribute, opts.except(:if, :unless)
end
f.template.concat buttons(f)
end
end
|