Insert new task when ENTER is pressed

This commit is contained in:
Abhishek Das
2013-03-25 01:17:16 +05:30
parent fc282d0723
commit e53369a5a2
3 changed files with 9 additions and 3 deletions
+7 -2
View File
@@ -31,8 +31,13 @@ var app = app || {};
this.$el.removeClass('editing');
},
add: function() {
this.$input.blur();
add: function(e) {
if (e.which === ENTER_KEY) {
this.$input.blur();
var render = new app.TaskView({model: new app.Task()}).render();
render.$el.insertAfter(this.$el);
render.$input.focus();
}
}
});