Commit edde2237 authored by Pascal Hartig's avatar Pascal Hartig

backbone: trim on edit (ref #635)

parent 8c48866b
......@@ -67,10 +67,11 @@ var app = app || {};
// Close the `"editing"` mode, saving changes to the todo.
close: function () {
var value = this.$input.val().trim();
var trimmedValue = this.$input.val().trim();
this.$input.val(trimmedValue);
if (value) {
this.model.save({ title: value });
if (trimmedValue) {
this.model.save({ title: trimmedValue });
} else {
this.clear();
}
......
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