Sha256: 9c8c1e35ced580cbe9e977f589e243fe0a88f434537bcbaee6b289eb175a2e30

Contents?: true

Size: 852 Bytes

Versions: 7

Compression:

Stored size: 852 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 = {}, &)
      default_options = {
        builder: AuthorizationFormBuilder,
        as: "authorization_handler",
        url: decidim_verifications.authorizations_path
      }

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
decidim-core-0.28.4 app/helpers/decidim/authorization_form_helper.rb
decidim-core-0.28.3 app/helpers/decidim/authorization_form_helper.rb
decidim-core-0.28.2 app/helpers/decidim/authorization_form_helper.rb
decidim-core-0.28.1 app/helpers/decidim/authorization_form_helper.rb
decidim-core-0.28.0 app/helpers/decidim/authorization_form_helper.rb
decidim-core-0.28.0.rc5 app/helpers/decidim/authorization_form_helper.rb
decidim-core-0.28.0.rc4 app/helpers/decidim/authorization_form_helper.rb