Commit 7d56ad3f authored by Fred Wu's avatar Fred Wu

Clear the input text field after adding a new entry

parent d95b22b7
......@@ -9,7 +9,8 @@
TaskApp.prototype.elements = {
'.items': 'tasks',
'.countVal': 'counter',
'a.clear': 'clearCompleted'
'a.clear': 'clearCompleted',
'form#new-task input[name=name]': 'newTaskName'
};
TaskApp.prototype.events = {
......@@ -31,7 +32,8 @@
TaskApp.prototype["new"] = function(e) {
e.preventDefault();
return Task.fromForm('form#new-task').save();
Task.fromForm('form#new-task').save();
return this.newTaskName.val('');
};
TaskApp.prototype.renderNew = function(task) {
......
......@@ -3,6 +3,7 @@ class TaskApp extends Spine.Controller
'.items': 'tasks'
'.countVal': 'counter'
'a.clear': 'clearCompleted'
'form#new-task input[name=name]': 'newTaskName'
events:
'submit form#new-task': 'new'
......@@ -19,6 +20,7 @@ class TaskApp extends Spine.Controller
new: (e) ->
e.preventDefault()
Task.fromForm('form#new-task').save()
@newTaskName.val('')
renderNew: (task) =>
view = new Tasks(task: task)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment