module SimpleForm

Constants

VERSION

Public Class Methods

additional_classes_for(component) { |: []| ... } click to toggle source
# File lib/simple_form.rb, line 199
def self.additional_classes_for(component)
  generate_additional_classes_for.include?(component) ? yield : []
end
build(options={}) { |builder| ... } click to toggle source

Builds a new wrapper using SimpleForm::Wrappers::Builder.

# File lib/simple_form.rb, line 178
def self.build(options={})
  options[:tag] = :div if options[:tag].nil?
  builder = SimpleForm::Wrappers::Builder.new(options)
  yield builder
  SimpleForm::Wrappers::Root.new(builder.to_a, options)
end
default_input_size=(*) click to toggle source

SETUP

# File lib/simple_form.rb, line 205
def self.default_input_size=(*)
  ActiveSupport::Deprecation.warn "[SIMPLE_FORM] SimpleForm.default_input_size= is deprecated and has no effect", caller
end
eager_load!() click to toggle source
Calls superclass method
# File lib/simple_form.rb, line 21
def self.eager_load!
  super
  SimpleForm::Inputs.eager_load!
  SimpleForm::Components.eager_load!
end
setup() { |self| ... } click to toggle source

Default way to setup SimpleForm. Run rails generate simple_form:install to create a fresh initializer with all configuration values.

# File lib/simple_form.rb, line 211
def self.setup
  yield self
end
wrapper(name) click to toggle source

Retrieves a given wrapper

# File lib/simple_form.rb, line 157
def self.wrapper(name)
  @@wrappers[name.to_sym] or raise WrapperNotFound, "Couldn't find wrapper with name #{name}"
end
wrappers(*args, &block) click to toggle source

Define a new wrapper using SimpleForm::Wrappers::Builder and store it in the given name.

# File lib/simple_form.rb, line 167
def self.wrappers(*args, &block)
  if block_given?
    options                 = args.extract_options!
    name                    = args.first || :default
    @@wrappers[name.to_sym] = build(options, &block)
  else
    @@wrappers
  end
end