Task gets added but not saved; Fix it

This commit is contained in:
Abhishek Das
2013-03-30 20:26:41 +05:30
parent 8b0f1a6dbc
commit cfca359bcf
2 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ var app = app || {};
},
initialize: function() {
this.collection = new app.List();
app.Tasks = this.collection = new app.List();
this.collection.fetch();
this.listenTo(this.collection, 'add', this.renderTask);
},
+5 -1
View File
@@ -48,7 +48,11 @@ var app = app || {};
add: function(e) {
if ( e.which === ENTER_KEY ) {
console.log('Add stuff here');
this.$input.blur();
var task = new app.Task({content:''});
var taskView = new app.TaskView({model:task}).render();
taskView.$el.insertAfter(this.$el);
taskView.$input.focus();
}
},