Module: SimpleForm::Components::Wrapper

Included in:
Inputs::Base
Defined in:
lib/simple_form/components/wrapper.rb

Instance Method Summary collapse

Instance Method Details

#wrap(content) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/simple_form/components/wrapper.rb', line 4

def wrap(content)
  if wrapper_tag && options[:wrapper] != false
    template.(wrapper_tag, content, wrapper_html_options)
  else
    content
  end
end

#wrapper_classObject



16
17
18
# File 'lib/simple_form/components/wrapper.rb', line 16

def wrapper_class
  options[:wrapper_class] || SimpleForm.wrapper_class
end

#wrapper_error_classObject



20
21
22
# File 'lib/simple_form/components/wrapper.rb', line 20

def wrapper_error_class
  options[:wrapper_error_class] || SimpleForm.wrapper_error_class
end

#wrapper_html_optionsObject



24
25
26
27
28
29
# File 'lib/simple_form/components/wrapper.rb', line 24

def wrapper_html_options
  css_classes = input_html_classes.unshift(wrapper_class)
  css_classes << wrapper_error_class if has_errors?
  css_classes << disabled_class if disabled?
  html_options_for(:wrapper, css_classes)
end

#wrapper_tagObject



12
13
14
# File 'lib/simple_form/components/wrapper.rb', line 12

def wrapper_tag
  options[:wrapper_tag] || SimpleForm.wrapper_tag
end