Module: Decidim::FiltersHelper

Includes:
IconHelper
Included in:
ResourceTypesFilterCell, ScopesPickerCell
Defined in:
app/helpers/decidim/filters_helper.rb

Overview

Helper that provides a single method to create filter resource forms

Instance Method Summary collapse

Methods included from IconHelper

#component_icon, #manifest_icon, #resource_icon, #resource_type_icon, #resource_type_icon_key, #text_with_resource_icon

Methods included from LayoutHelper

#_icon_classes, #apple_favicon, #application_path, #current_url, #current_user_unread_data, #extended_navigation_bar, #external_icon, #favicon, #icon, #legacy_favicon, #role

Methods included from TooltipHelper

#with_tooltip

Methods included from ModalHelper

#decidim_modal

Methods included from OrganizationHelper

#current_organization_name, #organization_colors, #organization_description_label, #organization_name

Methods included from TranslatableAttributes

#default_locale?

Instance Method Details

#filter_form_for(filter, url = url_for, html_options = {}) ⇒ Object

This method wraps everything in a div with class filters and calls the form_for helper with a custom builder

filter - A filter object url - A String with the URL to post the from. Self URL by default. html_options - Extra HTML options to be passed to form_for block - A block to be called with the form builder

Returns the filter resource form wrapped in a div



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'app/helpers/decidim/filters_helper.rb', line 17

def filter_form_for(filter, url = url_for, html_options = {})
  form_for(
    filter,
    namespace: filter_form_namespace,
    builder: FilterFormBuilder,
    url:,
    as: :filter,
    method: :get,
    remote: true,
    html: { id: nil }.merge(html_options)
  ) do |form|
    inner = []
    inner << hidden_field_tag("per_page", params[:per_page], id: nil) if params[:per_page]
    inner << capture { yield form }
    inner.join.html_safe
  end
end