Skip to content

Commit

Permalink
Added ProductLstView.
Browse files Browse the repository at this point in the history
  • Loading branch information
Toon Ketels committed Jul 28, 2012
1 parent 5196243 commit 6e34b38
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion public/javascripts/app.js
Expand Up @@ -18,5 +18,25 @@ Store.App = Backbone.Router.extend({
Store.products.deferred.done(function(){
productsList.render();
});
}
}
});


Store.ProductListView = Backbone.View.extend({
tagName: 'ul'
, className: 'products'
, render: function() {
for (var i = 0; i < this.collection.length; i++) {
this.renderItem(this.collection.models[i]);
}
$(this.container).find(this.className).remove();
this.$el.appendTo(this.options.container);
return this;
}
, renderItem: function( model ) {
var item = new Store.ProductListItemView({
"model": model
});
item.render().$el.appendTo(this.$el);
}
});

0 comments on commit 6e34b38

Please sign in to comment.