Created
July 6, 2012 16:03
-
-
Save brendanjerwin/3061074 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
| renderSubViews: function(options){ | |
| var el = options.el; | |
| var items = options.items; | |
| if(!el){throw Error('renderSubViews must be provided an el option to render into.');} | |
| if(!items){throw Error('renderSubViews must be provided and items option containing the models to render.');} | |
| if(!this.subView){throw Error('cannot call renderSubView without the view implementing the subView key.'); } | |
| var i,j; | |
| this._glee_items_el = el; | |
| for(i=0,j=items.length;i<j;i++){ | |
| this.addSubView(items[i], options); | |
| } | |
| }, | |
| addSubView: function(item, extraOI){ | |
| if(!this._glee_items_el){throw Error('cannot call addSubView before renderSubViews.'); } | |
| this._glee_items.push(this._SubView.render(_.extend({model:item, el: this._glee_items_el}, this.oi, extraOI))); | |
| }, | |
| getSubViews: function() { | |
| return this._glee_items; | |
| }, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment