Sha256: 13683a82664fc86256aa6f2c9a146ef8b5dc75d1f7916ecc597146d9aebad899

Contents?: true

Size: 833 Bytes

Versions: 27

Compression:

Stored size: 833 Bytes

Contents

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.merge!({
          builder: Alchemy::Forms::Builder,
          remote: request.xhr?,
          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

27 entries across 27 versions & 2 rubygems

Version Path
alchemy_cms-3.2.1 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.1.3 app/helpers/alchemy/admin/form_helper.rb
lc_alchemy_cms-3.2.1 app/helpers/alchemy/admin/form_helper.rb
lc_alchemy_cms-3.2.0 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.2.0 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.2.0.rc1 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.2.0.beta app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.1.1 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.0.4 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.1.0 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.1.0.rc3 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.1.0.rc2 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.1.0.rc1 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.1.0.beta6 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.1.0.beta5 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.1.0.beta4 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.0.3 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.1.0.beta3 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.1.0.beta2 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-3.1.0.beta1 app/helpers/alchemy/admin/form_helper.rb