Sha256: 4197057ff6b02f81c6767644a7de7571ef513242155fef108072427ef259202e

Contents?: true

Size: 780 Bytes

Versions: 5

Compression:

Stored size: 780 Bytes

Contents

# frozen_string_literal: true

module Decidim
  # Helper that provides a single method to create filter resource forms
  module FiltersHelper
    # 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.
    # block  - A block to be called with the form builder
    #
    # Returns the filter resource form wrapped in a div
    def filter_form_for(filter, url = url_for)
      content_tag :div, class: "filters" do
        form_for filter, builder: FilterFormBuilder, url: url, as: :filter, method: :get, remote: true, html: { id: nil } do |form|
          yield form
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-core-0.16.1 app/helpers/decidim/filters_helper.rb
decidim-core-0.16.0 app/helpers/decidim/filters_helper.rb
decidim-core-0.15.2 app/helpers/decidim/filters_helper.rb
decidim-core-0.15.1 app/helpers/decidim/filters_helper.rb
decidim-core-0.15.0 app/helpers/decidim/filters_helper.rb