Skip to content

Commit

Permalink
Implement removal of items when blanked on edit.
Browse files Browse the repository at this point in the history
  • Loading branch information
boushley committed Feb 27, 2012
1 parent 7405c80 commit 8f9ee83
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion architecture-examples/backbone/js/app.js
Expand Up @@ -129,7 +129,12 @@ $(function(){

// Close the `"editing"` mode, saving changes to the todo.
close: function() {
this.model.save({title: this.input.val()});
var value = this.input.val().trim();

if (!value)
this.clear();

this.model.save({title: value});
$(this.el).removeClass("editing");
},

Expand Down

0 comments on commit 8f9ee83

Please sign in to comment.