return $("<div/>").html(encodedText).text();
},
toggleComplete: function() {
- this.stopEditingText();
- this.model.toggleComplete();
- var next = this.model.nextNode(this.model.collection, {"childrenAllowed":false});
- if (!next) return false;
- next.getView().startEditingText();
+ if (this.model.get("completed")) {
+ this.stopEditingText();
+ this.model.toggleComplete();
+ this.startEditingText(); // TODO: Don't lose place
+ } else {
+ this.stopEditingText();
+ this.model.toggleComplete();
+ var next = this.model.nextNode(this.model.collection, {"childrenAllowed":false});
+ if (!next) return false;
+ next.getView().startEditingText();
+ }
return false; // Don't propogate
},
backspace: function() {
return $("<div/>").html(encodedText).text();
},
toggleComplete: function() {
- this.stopEditingText();
- this.model.toggleComplete();
- var next = this.model.nextNode(this.model.collection, {"childrenAllowed":false});
- if (!next) return false;
- next.getView().startEditingText();
+ if (this.model.get("completed")) {
+ this.stopEditingText();
+ this.model.toggleComplete();
+ this.startEditingText(); // TODO: Don't lose place
+ } else {
+ this.stopEditingText();
+ this.model.toggleComplete();
+ var next = this.model.nextNode(this.model.collection, {"childrenAllowed":false});
+ if (!next) return false;
+ next.getView().startEditingText();
+ }
return false; // Don't propogate
},
backspace: function() {
return $("<div/>").html(encodedText).text();
},
toggleComplete: function() {
- this.stopEditingText();
- this.model.toggleComplete();
- var next = this.model.nextNode(this.model.collection, {"childrenAllowed":false});
- if (!next) return false;
- next.getView().startEditingText();
+ if (this.model.get("completed")) {
+ this.stopEditingText();
+ this.model.toggleComplete();
+ this.startEditingText(); // TODO: Don't lose place
+ } else {
+ this.stopEditingText();
+ this.model.toggleComplete();
+ var next = this.model.nextNode(this.model.collection, {"childrenAllowed":false});
+ if (!next) return false;
+ next.getView().startEditingText();
+ }
return false; // Don't propogate
},
backspace: function() {