Created
May 18, 2012 20:13
-
-
Save Enome/2727378 to your computer and use it in GitHub Desktop.
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 field(type, name, label) | |
-var form_model = locals.form_model || {} | |
if type === 'hidden' | |
input(name=name, type=type, value=form_model[name]) | |
else | |
.control-group(class=locals.fieldClass(name, locals.errors)) | |
label.control-label(for='id_' + name) #{label} | |
.controls | |
if type == 'textarea' | |
.input | |
textarea.span6(id='id_' + name, name=name)= form_model[name] | |
else | |
.input | |
input.span6(id='id_' + name, name=name, type=type, value=form_model[name]) | |
mixin submit(text) | |
button.btn.btn-large.btn-success #{text} | |
mixin csrf() | |
input(type='hidden', name='authenticity_token', value=locals.session._csrf) | |
mixin errors() | |
-var errors = locals.errors; | |
- if (typeof(errors) != 'undefined') | |
.alert.alert-error | |
ul | |
each v, k in errors | |
li | |
b= k + ': ' | |
span= v.join(', ') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment