Sha256: 6df434824050f40147b30e12f500702027b0f157c5dae91409a9678c172f3ced

Contents?: true

Size: 846 Bytes

Versions: 88

Compression:

Stored size: 846 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

88 entries across 88 versions & 1 rubygems

Version Path
alchemy_cms-5.1.10 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.0.10 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-6.0.0.pre.rc5 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-6.0.0.pre.rc4 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-6.0.0.pre.rc3 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.2.5 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.1.9 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.0.9 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.2.4 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.1.8 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.0.8 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.0.7 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.1.7 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.2.3 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-6.0.0.pre.rc2 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.1.6 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.0.6 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.2.2 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.1.5 app/helpers/alchemy/admin/form_helper.rb
alchemy_cms-5.0.5 app/helpers/alchemy/admin/form_helper.rb