Created
October 12, 2012 08:34
-
-
Save rashfael/3878057 to your computer and use it in GitHub Desktop.
form helper jade
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mixin textfield(options) | |
.control-group | |
label.control-label(for=options.name)= options.label | |
.controls | |
div(class=options.append ? 'input-append' : '') | |
- var classArr = []; | |
- if(options.size) | |
- classArr.push(options.size); | |
- else | |
- classArr.push('span8'); | |
- if(options.disabled) | |
- classArr.push('disabled'); | |
input(class=classArr, type='text', name=options.name, id=options.name, value=options.value, placeholder=options.placeholder || options.label) | |
span.add-on= options.append | |
mixin textarea(options) | |
.control-group | |
label.control-label(for=options.name)= options.label | |
.controls | |
textarea.span8(class=options.size || "span8", name=options.name, id=options.name, placeholder=options.placeholder || options.label, rows=3)= options.value | |
if options.help | |
span.help-block= options.help | |
mixin select(name, values, label) | |
.clearfix | |
label(for=name)= label | |
.input | |
select.xlarge(name=name) | |
- each value in values | |
-for (key in value) break; | |
option(value=key)= value[key] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment