# File lib/simple_form.rb, line 199 def self.additional_classes_for(component) generate_additional_classes_for.include?(component) ? yield : [] end
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
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
# File lib/simple_form.rb, line 21 def self.eager_load! super SimpleForm::Inputs.eager_load! SimpleForm::Components.eager_load! end
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
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
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