Sha256: b0b93e5e91ec74ab39dbeb9697949bb38d7622683626f8d44135330dbc4ac27c

Contents?: true

Size: 845 Bytes

Versions: 53

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

53 entries across 53 versions & 1 rubygems

Version Path
alchemy_cms-7.3.6 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.2.9 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.3.5 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.2.8 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.1.13 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.0.16 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.3.4 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.3.3 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.3.2 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.2.7 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.3.1 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.3.0 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.2.6 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.2.5 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.1.12 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.0.15 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.2.4 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.1.11 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.2.3 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-7.1.10 app/helpers/alchemy/admin/form_helper.rb