Sha256: 1257f33ce0a2c94cb9a15d2f036b29a260b672c15d5a27ef15a19075fedf824a

Contents?: true

Size: 845 Bytes

Versions: 39

Compression:

Stored size: 845 Bytes

Contents

# frozen_string_literal: true

module Alchemy
  module Admin
    module FormHelper
      # Use this form helper to render any form in Alchemy admin interface.
      #
      # This is simply a wrapper for `simple_form_for`
      #
      # == Defaults
      #
      # * It uses Alchemy::Forms::Builder as builder
      # * It makes a remote request, if the request was XHR request.
      # * It adds the alchemy class to form
      #
      def alchemy_form_for(object, *args, &block)
        options = args.extract_options!
        options[:builder] = Alchemy::Forms::Builder
        options[:remote] = request.xhr?
        options[:html] = {
          id: options.delete(:id),
          class: ["alchemy", options.delete(:class)].compact.join(' ')
        }
        simple_form_for(object, *(args << options), &block)
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
alchemy_cms-4.6.7 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.6.6 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.6.5 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.5.1 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.4.5 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.6.4 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.0.6 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.6.3 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.6.2 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.6.1 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.6.0 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.5.0 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.4.4 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.4.3 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.4.2 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.4.1 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.4.0 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.3.2 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.2.4 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-4.3.1 app/helpers/alchemy/admin/form_helper.rb