From: Zachary Vance Date: Thu, 9 Apr 2015 01:00:37 +0000 (-0700) Subject: Display all todos X-Git-Url: https://git.za3k.com/?a=commitdiff_plain;h=305b3db8096463f6656b3ba02e539f742ce3428d;p=flowy.git Display all todos --- diff --git a/dist/flowy.js b/dist/flowy.js index 79b8265..1174feb 100644 --- a/dist/flowy.js +++ b/dist/flowy.js @@ -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); diff --git a/dist/flowy.unwrapped.js b/dist/flowy.unwrapped.js index 4c1b671..0dcaa6c 100644 --- a/dist/flowy.unwrapped.js +++ b/dist/flowy.unwrapped.js @@ -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); diff --git a/src/views/app.js b/src/views/app.js index 5e0021c..064ce79 100644 --- a/src/views/app.js +++ b/src/views/app.js @@ -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);