Skip to content

Instantly share code, notes, and snippets.

@alejandroiglesias
Created December 11, 2012 19:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alejandroiglesias/4261572 to your computer and use it in GitHub Desktop.
Save alejandroiglesias/4261572 to your computer and use it in GitHub Desktop.
var View = Base.extend({
initialize: function () {
console.log('view init');
if ( ! this.el) {
this.el = this.el || document.createElement(this.tagName);
}
}
});
var FilterListView = View.extend({
tagName: 'ol',
initialize: function (props) {
View.prototype.initialize.call(this, props);
console.log('filter list view init');
this.constructor.prototype.initialize();
$.extend(this, props);
$(this.model).on('reset', $.proxy(this.render, this));
},
render: function (eventName) {
console.log('FilterListView::render()', this.model.models, eventName);
_.each(this.model.models, function (filter) {
$(this.el).append(new FilterListItemView({ model: filter }).render().el);
}, this);
return this;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment