module ExtForm::Wrappers::Mixin

Public Instance Methods

wrap_style_options(input, type, namespace) click to toggle source
# File lib/ext_form/wrappers/mixin.rb, line 6
def wrap_style_options(input, type, namespace)
  l = input.l
  options = input.options

  if l.instance_of?(ExtForm::Layouts::DefaultLayout)
    default_style_options(l, type, namespace, options)
    input.input_html_classes.unshift('input-with-layout') if type == 'input'
  else
    bootstrap_style_options(l, type, namespace, options)
    input.input_html_classes.unshift(options[:"#{namespace}_html"][:class]) if type == 'input'
  end
end

Private Instance Methods

bootstrap_style_options(l, type, namespace, options={}) click to toggle source
# File lib/ext_form/wrappers/mixin.rb, line 34
def bootstrap_style_options(l, type, namespace, options={})
  html_option = options.delete(:"#{namespace}_html") || {}

  clazz = []
  clazz << html_option.delete(:class)
  clazz << "span#{l.send("#{type}_width", options[:input_seq]%l.layout.size)}"

  html_option[:class] = clazz.compact.join(' ')

  options[:"#{namespace}_html"] = html_option
  options
end
default_style_options(l, type, namespace, options={}) click to toggle source
# File lib/ext_form/wrappers/mixin.rb, line 20
def default_style_options(l, type, namespace, options={})
  html_option = options.delete(:"#{namespace}_html") || {}

  style = []
  style << html_option.delete(:style)
  style << "width: #{l.send("#{type}_width", options[:input_seq]%l.layout.size)}#{l.layout_config[:measure]}; " \
           "float: left;"

  html_option[:style] = style.compact.join(';')

  options[:"#{namespace}_html"] = html_option
  options
end