Module: Decidim::FiltersHelper
- Included in:
- ScopesPickerCell, UserActivityCell
- Defined in:
- app/helpers/decidim/filters_helper.rb
Overview
Helper that provides a single method to create filter resource forms
Instance Method Summary collapse
-
#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.
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
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/helpers/decidim/filters_helper.rb', line 15 def filter_form_for(filter, url = url_for, = {}) content_tag :div, class: "filters" do form_for( filter, namespace: filter_form_namespace, builder: FilterFormBuilder, url: url, as: :filter, method: :get, remote: true, html: { id: nil }.merge() ) do |form| # Cannot use `concat()` here because it's not available in cells 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 end |