Module: ActiveAdmin::ViewHelpers::FilterFormHelper
- Included in:
- ActiveAdmin::ViewHelpers
- Defined in:
- lib/active_admin/view_helpers/filter_form_helper.rb
Instance Method Summary collapse
-
#active_admin_filters_form_for(search, filters, options = {}) ⇒ Object
Helper method to render a filter form.
Instance Method Details
#active_admin_filters_form_for(search, filters, options = {}) ⇒ Object
Helper method to render a filter form
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/active_admin/view_helpers/filter_form_helper.rb', line 7 def active_admin_filters_form_for(search, filters, = {}) [:builder] ||= ActiveAdmin::FilterFormBuilder [:url] ||= collection_path [:html] ||= {} [:html][:method] = :get [:as] = :q clear_link = link_to(I18n.t('active_admin.clear_filters'), "#", :class => "clear_filters_btn") form_for search, do |f| filters.each do || = .dup attribute = .delete(:attribute) f.filter attribute, end = content_tag :div, :class => "buttons" do f.submit(I18n.t('active_admin.filter')) + clear_link + hidden_field_tag("order", params[:order]) + hidden_field_tag("scope", params[:scope]) end f.form_buffers.last + end end |