]> git.za3k.com Git - flowy.git/commitdiff
Display all todos
authorZachary Vance <vanceza@gmail.com>
Thu, 9 Apr 2015 01:00:37 +0000 (18:00 -0700)
committerZachary Vance <vanceza@gmail.com>
Thu, 9 Apr 2015 01:00:37 +0000 (18:00 -0700)
dist/flowy.js
dist/flowy.unwrapped.js
src/views/app.js

index 79b826560aa61e2af3a58b84167b7917eab012c9..1174feb84b199041bf04ff0cd180f6767ec0306b 100644 (file)
@@ -91,53 +91,51 @@ var FlowyDocModel = Backbone.Collection.extend({
  * @depend ../models/todo.js
  */
 
+var testTodos = [
+    new TodoModel({
+        parent: null,
+        id: 1,
+        text: "Daily todos",
+        bullets: [2,3,4],
+    }),
+    new TodoModel({
+        parent: 1,
+        id: 2,
+        text: "Shave",
+        completed: true
+    }),
+    new TodoModel({
+        parent: 1,
+        id: 3,
+        text: "Check t-mail",
+        completed: true
+    }),
+    new TodoModel({
+        parent: 1,
+        id: 4,
+        text: "Eat green eggs and ham",
+    }),
+    new TodoModel({
+        parent: null,
+        id: 5,
+        text: "To do this year",
+        collapsed: true,
+        bullets: [6],
+    }),
+    new TodoModel({
+        parent: 5,
+        id: 6,
+        text: "Save the world",
+        bullets: [7],
+    }),
+    new TodoModel({
+        parent: 6,
+        id: 7,
+        text: "Save California",
+    }),
+];
+
 var todos = new FlowyDocModel({
-    /*
-    id: "master",
-    default: [
-        new TodoModel({
-            parent: null,
-            id: 1,
-            text: "Daily todos",
-            bullets: [2,3,4],
-        }),
-        new TodoModel({
-            parent: 1,
-            id: 2,
-            text: "Shave",
-            completed: true
-        }),
-        new TodoModel({
-            parent: 1,
-            id: 3,
-            text: "Check t-mail",
-            completed: true
-        }),
-        new TodoModel({
-            parent: 1,
-            id: 4,
-            text: "Eat green eggs and ham",
-        }),
-        new TodoModel({
-            parent: null,
-            id: 5,
-            text: "To do this year",
-            collapsed: true,
-            bullets: [6],
-        }),
-        new TodoModel({
-            parent: 5,
-            id: 6,
-            text: "Save the world",
-            bullets: [7],
-        }),
-        new TodoModel({
-            parent: 6,
-            id: 7,
-            text: "Save California",
-        }),
-    ],
-    */
 });
 
 var appDefaults = { list: todos };
@@ -163,10 +161,11 @@ var AppView = Backbone.View.extend({
             return;
         }
         var view = new TodoView({model: todo});
-        this.setView(todo, view);
         if (todo.isTopLevel(this.list)) {
+            this.setView(todo, view);
             this.$("#todo-list").append(view.render().el);
         } else if (todo.isParentLoaded(this.list, this)) {
+            this.setView(todo, view);
             var parent = todo.getParent(this.list);
             var parentView = this.getView(parent);
             parentView.addChild(view.render().el);
index 4c1b6716dfddba76adcea08e28dc5ef1fd4366ce..0dcaa6c5b78bfaa841ebd755bd280a4cfc694c27 100644 (file)
@@ -90,53 +90,51 @@ var FlowyDocModel = Backbone.Collection.extend({
  * @depend ../models/todo.js
  */
 
+var testTodos = [
+    new TodoModel({
+        parent: null,
+        id: 1,
+        text: "Daily todos",
+        bullets: [2,3,4],
+    }),
+    new TodoModel({
+        parent: 1,
+        id: 2,
+        text: "Shave",
+        completed: true
+    }),
+    new TodoModel({
+        parent: 1,
+        id: 3,
+        text: "Check t-mail",
+        completed: true
+    }),
+    new TodoModel({
+        parent: 1,
+        id: 4,
+        text: "Eat green eggs and ham",
+    }),
+    new TodoModel({
+        parent: null,
+        id: 5,
+        text: "To do this year",
+        collapsed: true,
+        bullets: [6],
+    }),
+    new TodoModel({
+        parent: 5,
+        id: 6,
+        text: "Save the world",
+        bullets: [7],
+    }),
+    new TodoModel({
+        parent: 6,
+        id: 7,
+        text: "Save California",
+    }),
+];
+
 var todos = new FlowyDocModel({
-    /*
-    id: "master",
-    default: [
-        new TodoModel({
-            parent: null,
-            id: 1,
-            text: "Daily todos",
-            bullets: [2,3,4],
-        }),
-        new TodoModel({
-            parent: 1,
-            id: 2,
-            text: "Shave",
-            completed: true
-        }),
-        new TodoModel({
-            parent: 1,
-            id: 3,
-            text: "Check t-mail",
-            completed: true
-        }),
-        new TodoModel({
-            parent: 1,
-            id: 4,
-            text: "Eat green eggs and ham",
-        }),
-        new TodoModel({
-            parent: null,
-            id: 5,
-            text: "To do this year",
-            collapsed: true,
-            bullets: [6],
-        }),
-        new TodoModel({
-            parent: 5,
-            id: 6,
-            text: "Save the world",
-            bullets: [7],
-        }),
-        new TodoModel({
-            parent: 6,
-            id: 7,
-            text: "Save California",
-        }),
-    ],
-    */
 });
 
 var appDefaults = { list: todos };
@@ -162,10 +160,11 @@ var AppView = Backbone.View.extend({
             return;
         }
         var view = new TodoView({model: todo});
-        this.setView(todo, view);
         if (todo.isTopLevel(this.list)) {
+            this.setView(todo, view);
             this.$("#todo-list").append(view.render().el);
         } else if (todo.isParentLoaded(this.list, this)) {
+            this.setView(todo, view);
             var parent = todo.getParent(this.list);
             var parentView = this.getView(parent);
             parentView.addChild(view.render().el);
index 5e0021cef0352b41b78a076a8883d84892d2b5b2..064ce7910307ba5b1f9032fa7b4577ffccabda88 100644 (file)
@@ -4,53 +4,51 @@
  * @depend ../models/todo.js
  */
 
+var testTodos = [
+    new TodoModel({
+        parent: null,
+        id: 1,
+        text: "Daily todos",
+        bullets: [2,3,4],
+    }),
+    new TodoModel({
+        parent: 1,
+        id: 2,
+        text: "Shave",
+        completed: true
+    }),
+    new TodoModel({
+        parent: 1,
+        id: 3,
+        text: "Check t-mail",
+        completed: true
+    }),
+    new TodoModel({
+        parent: 1,
+        id: 4,
+        text: "Eat green eggs and ham",
+    }),
+    new TodoModel({
+        parent: null,
+        id: 5,
+        text: "To do this year",
+        collapsed: true,
+        bullets: [6],
+    }),
+    new TodoModel({
+        parent: 5,
+        id: 6,
+        text: "Save the world",
+        bullets: [7],
+    }),
+    new TodoModel({
+        parent: 6,
+        id: 7,
+        text: "Save California",
+    }),
+];
+
 var todos = new FlowyDocModel({
-    /*
-    id: "master",
-    default: [
-        new TodoModel({
-            parent: null,
-            id: 1,
-            text: "Daily todos",
-            bullets: [2,3,4],
-        }),
-        new TodoModel({
-            parent: 1,
-            id: 2,
-            text: "Shave",
-            completed: true
-        }),
-        new TodoModel({
-            parent: 1,
-            id: 3,
-            text: "Check t-mail",
-            completed: true
-        }),
-        new TodoModel({
-            parent: 1,
-            id: 4,
-            text: "Eat green eggs and ham",
-        }),
-        new TodoModel({
-            parent: null,
-            id: 5,
-            text: "To do this year",
-            collapsed: true,
-            bullets: [6],
-        }),
-        new TodoModel({
-            parent: 5,
-            id: 6,
-            text: "Save the world",
-            bullets: [7],
-        }),
-        new TodoModel({
-            parent: 6,
-            id: 7,
-            text: "Save California",
-        }),
-    ],
-    */
 });
 
 var appDefaults = { list: todos };
@@ -76,10 +74,11 @@ var AppView = Backbone.View.extend({
             return;
         }
         var view = new TodoView({model: todo});
-        this.setView(todo, view);
         if (todo.isTopLevel(this.list)) {
+            this.setView(todo, view);
             this.$("#todo-list").append(view.render().el);
         } else if (todo.isParentLoaded(this.list, this)) {
+            this.setView(todo, view);
             var parent = todo.getParent(this.list);
             var parentView = this.getView(parent);
             parentView.addChild(view.render().el);