]> git.za3k.com Git - flowy.git/commitdiff
Maintain cursor position while un-completing an item
authorZachary Vance <vanceza@gmail.com>
Thu, 28 May 2015 00:53:46 +0000 (17:53 -0700)
committerZachary Vance <vanceza@gmail.com>
Thu, 28 May 2015 00:53:46 +0000 (17:53 -0700)
dist/flowy.js
dist/flowy.unwrapped.js
src/views/todo.js

index fefa3a464162aea2b08c23cab8f9f5c29966f412..395bb7a4279df4aed470871f06474b04fe9912bf 100644 (file)
@@ -461,9 +461,11 @@ var TodoView = Backbone.View.extend({
   },
   toggleComplete: function() {
     if (this.model.get("completed")) {
-        this.stopEditingText();
-        this.model.toggleComplete();
-        this.startEditingText(); // TODO: Don't lose place
+        var self = this;
+        this._maintainingFocus(function() {
+            self.stopEditingText();
+            self.model.toggleComplete();
+        });
     } else {
         this.stopEditingText();
         this.model.toggleComplete();
index 20777ee66bdec48a04b2fa192059ac12ace7542c..6fee3ce091dadc8ea63b9ceb35404ad9b8019885 100644 (file)
@@ -460,9 +460,11 @@ var TodoView = Backbone.View.extend({
   },
   toggleComplete: function() {
     if (this.model.get("completed")) {
-        this.stopEditingText();
-        this.model.toggleComplete();
-        this.startEditingText(); // TODO: Don't lose place
+        var self = this;
+        this._maintainingFocus(function() {
+            self.stopEditingText();
+            self.model.toggleComplete();
+        });
     } else {
         this.stopEditingText();
         this.model.toggleComplete();
index f5df8010cd9a06963c0b2b43fda955a8a08c0004..12b9c2baac7f0119b46a4f7dcac9f37160c63b16 100644 (file)
@@ -64,9 +64,11 @@ var TodoView = Backbone.View.extend({
   },
   toggleComplete: function() {
     if (this.model.get("completed")) {
-        this.stopEditingText();
-        this.model.toggleComplete();
-        this.startEditingText(); // TODO: Don't lose place
+        var self = this;
+        this._maintainingFocus(function() {
+            self.stopEditingText();
+            self.model.toggleComplete();
+        });
     } else {
         this.stopEditingText();
         this.model.toggleComplete();