Files
HackFlowy/public/javascripts/views/list.js
T
2013-03-25 01:24:16 +05:30

26 lines
519 B
JavaScript

var app = app || {};
(function() {
app.ListView = Backbone.View.extend({
el: $("#main .children"),
initialize: function(initialTasks) {
this.collection = new app.List(initialTasks);
this.render();
},
render: function() {
this.collection.each(function(task) {
this.renderTask(task);
}, this);
},
renderTask: function(task) {
var taskView = new app.TaskView({
model: task
});
this.$el.append(taskView.render().el);
}
});
}());