 createLabel = (text, name) ->
   tag 'label',
     for: "input-#{name}"
+    className: 'control-label'
   , text
 
-wrap = (content) ->
+wrap = (content, label) ->
+  content = createLabel(label) + content if label
   tag 'div', class: 'form-group', content
 
 tag = (el, attrs={}, content='', options={}) ->

Handlebars.registerHelper 'checkbox', (name, value, options) ->
  settings = _.defaults options.hash,
    label: false
    tabindex: ''

  checkedText = if value is true then ' checked' else ''
  labelText = if settings.label then settings.label else ''

    _.extend params,
      'data-sluggify': options.hash.sluggify

  wrap tag('input', params, false, selfClosing: true), settings.label

Handlebars.registerHelper 'textarea', (name, value, options) ->
  settings = options.hash

  textarea = tag 'textarea',
    name: name
    className: settings.className || 'form-control'
    id: "input-#{name}"
    placeholder: settings.placeholder
    tabindex: settings.tabindex
    rows: settings.rows
  , value

  wrap textarea, settings.label if settings.label


Handlebars.registerHelper 'submit', (text, options) ->
