class SimpleForm::Wrappers::Root
always have a namespace and to add special html classes.
‘Root` is the root wrapper for all components. It is special cased to
def find(name)
def find(name) super || SimpleForm::Wrappers::Many.new(name, [Leaf.new(name)]) end
def html_class(key, options)
def html_class(key, options) css = (options[:"wrapper_#{key}"] || @defaults[key]) css if css && yield end
def html_classes(input, options)
def html_classes(input, options) css = options[:wrapper_class] ? Array(options[:wrapper_class]) : @defaults[:class] css += SimpleForm.additional_classes_for(:wrapper) do input.additional_classes + [input.input_class] end css << html_class(:error_class, options) { input.has_errors? } css << html_class(:hint_class, options) { input.has_hint? } css << html_class(:valid_class, options) { input.valid? } css.compact end
def initialize(*args)
def initialize(*args) super(:wrapper, *args) @options = @defaults.except(:tag, :class, :error_class, :hint_class) end
def render(input)
def render(input) input.options.reverse_merge!(@options) super end