class Forme::Wrapper::Bootstrap3

  1. lib/forme/bs3.rb
Superclass: Wrapper

Wraps inputs with <div class=“form-group”>

Methods

Public Instance

  1. call

Public Instance methods

call(tag, input)

Wrap the input in the tag of the given type.

[show source]
    # File lib/forme/bs3.rb
317 def call(tag, input)
318   attr = input.opts[:wrapper_attr] ? input.opts[:wrapper_attr].dup : { }
319   klass = attr[:class] ? attr[:class].split(' ').unshift('form-group').uniq : ['form-group']
320   
321   case input.type
322   when :submit, :reset
323     [tag]
324   when :radio, :checkbox
325     klass.delete('form-group')
326     klass.unshift( input.type.to_s )
327     attr[:class] = klass.sort.uniq.join(' ').strip
328     [input.tag(:div, attr, tag)]
329   when :hidden
330     super
331   else
332     attr[:class] = klass.sort.uniq.join(' ').strip
333     [input.tag(:div, attr, [tag])]
334   end
335 
336 end