Created
August 17, 2012 15:27
-
-
Save jshirley/3379888 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /* | |
| */ | |
| var template = Y.Handlebars.compile('{{{ render_form form }}}'), | |
| goal = this.get('model'), | |
| output = template( | |
| { | |
| form : { | |
| /** | |
| Values is a short-hand, it just sets values for each of the elements below correctly. | |
| **/ | |
| values : goal.toJSON(), | |
| /** | |
| Define the fields as an array, you can also pass in `error` as a key and it displays errors. | |
| **/ | |
| fields : [ | |
| { label : 'Goal', name : 'name', required : true }, | |
| { label : 'More', name : 'description' }, | |
| { label : 'Category', name : 'category_id', type : 'select', options : categories }, | |
| { label : 'Color', inputClassNames : [ 'color-input', 'color-swatch' ], name : 'color' }, | |
| { label : 'Privacy', name : 'public', type : 'options', options : [ | |
| { 'name' : 'public', 'value' : 1, label : 'Public (based on your account privacy settings)', type : 'radio' }, | |
| { 'name' : 'public', 'value' : 0, label : 'Private (only you can see)', type : 'radio' } | |
| ] } | |
| ], | |
| buttons : [ | |
| { classNames : 'btn', label : 'Cancel', link : '/' }, | |
| { classNames : [ 'btn', 'btn-primary' ], label : 'Save' } | |
| ] | |
| } | |
| }, | |
| { | |
| partials : this.partials | |
| } | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment