Sha256: 8b30d8ac4cc5f2388711763194a68105cfa23a37702fa243b36594a79ca2c677

Contents?: true

Size: 839 Bytes

Versions: 5

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true
module Decidim
  # A heper to expose an easy way to add authorization forms in a view.
  module AuthorizationFormHelper
    # Creates a ew authorization form in a view, accepts the same arguments as
    # `form_for`.
    #
    # record  - The record to use in the form, it shoulde be a descendant of
    # AuthorizationHandler.
    # options - An optional hash with options to pass wo the form builder.
    # block   - A block with the content of the form.
    #
    # Returns a String.
    def authorization_form_for(record, options = {}, &block)
      default_options = {
        builder: AuthorizationFormBuilder,
        as: "authorization_handler",
        url: authorizations_path
      }

      options = default_options.merge(options)
      decidim_form_for(record, options, &block)
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
decidim-core-0.1.0 app/helpers/decidim/authorization_form_helper.rb
decidim-core-0.0.8.1 app/helpers/decidim/authorization_form_helper.rb
decidim-core-0.0.7 app/helpers/decidim/authorization_form_helper.rb
decidim-core-0.0.6 app/helpers/decidim/authorization_form_helper.rb
decidim-core-0.0.5 app/helpers/decidim/authorization_form_helper.rb