Class: ActiveAdmin::FilterFormBuilder

Inherits:
FormBuilder show all
Defined in:
lib/active_admin/view_helpers/filter_form_helper.rb

Overview

This form builder defines methods to build filter forms such as the one found in the sidebar of the index page of a standard resource.

Instance Attribute Summary

Attributes inherited from FormBuilder

#form_buffers

Instance Method Summary collapse

Methods inherited from FormBuilder

#buttons, #cancel_link, #commit_button, #commit_button_with_cancel_link, #datepicker_input, #has_many, #initialize, #input, #inputs

Constructor Details

This class inherits a constructor from ActiveAdmin::FormBuilder

Instance Method Details

#filter(method, options = {}) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/active_admin/view_helpers/filter_form_helper.rb', line 39

def filter(method, options = {})
  return "" if method.nil? || method == ""
  options[:as] ||= default_filter_type(method)
  return "" unless options[:as]
  field_type = options.delete(:as)
  options[:label] ||= default_filter_label(method)
  content = with_new_form_buffer do
    send("filter_#{field_type}_input", method, options)
  end
  @form_buffers.last << template.(:div, content, :class => "filter_form_field filter_#{field_type}")
end