diff --git a/labs/architecture-examples/backbone.xmpp/index.html b/labs/architecture-examples/backbone.xmpp/index.html index dfc2b18368..4a332a0780 100644 --- a/labs/architecture-examples/backbone.xmpp/index.html +++ b/labs/architecture-examples/backbone.xmpp/index.html @@ -56,7 +56,7 @@

todos

- + diff --git a/labs/architecture-examples/backbone.xmpp/js/app.js b/labs/architecture-examples/backbone.xmpp/js/app.js index 8f5d859fc2..8ac01d95b9 100644 --- a/labs/architecture-examples/backbone.xmpp/js/app.js +++ b/labs/architecture-examples/backbone.xmpp/js/app.js @@ -1,6 +1,10 @@ var app = app || {}; app.start = function () { + // Create our global collection of **Todos**. + app.Todos.initialize([], {id: 'todos', connection: app.connection}); + Backbone.history.start(); + // Kick things off by creating the **App**. new app.AppView(); }; @@ -44,7 +48,6 @@ $(function() { cp.always(function () { app.start(); }); - } }); diff --git a/labs/architecture-examples/backbone.xmpp/js/collections/todos.js b/labs/architecture-examples/backbone.xmpp/js/collections/todos.js index 0a1759b298..2978329aa2 100644 --- a/labs/architecture-examples/backbone.xmpp/js/collections/todos.js +++ b/labs/architecture-examples/backbone.xmpp/js/collections/todos.js @@ -8,14 +8,11 @@ var app = app || {}; // The collection of todos is backed by *localStorage* instead of a remote // server. - var TodoList = Backbone.Collection.extend({ + var TodoList = PubSubNode.extend({ // Reference to this collection's model. model: app.Todo, - // Save all of the todo items under the `"todos"` namespace. - localStorage: new Store('todos-backbone'), - // Filter down the list of all todo items that are finished. completed: function() { return this.filter(function( todo ) { @@ -44,6 +41,6 @@ var app = app || {}; }); // Create our global collection of **Todos**. - app.Todos = new TodoList(); + app.Todos = new TodoList(); app.Todos = new TodoList(); }()); diff --git a/labs/architecture-examples/backbone.xmpp/js/models/todo.js b/labs/architecture-examples/backbone.xmpp/js/models/todo.js index 13a7b9b346..28e7e1f3c7 100644 --- a/labs/architecture-examples/backbone.xmpp/js/models/todo.js +++ b/labs/architecture-examples/backbone.xmpp/js/models/todo.js @@ -7,7 +7,7 @@ var app = app || {}; // ---------- // Our basic **Todo** model has `title`, `order`, and `completed` attributes. - app.Todo = Backbone.Model.extend({ + app.Todo = PubSubItem.extend({ // Default attributes for the todo // and ensure that each todo created has `title` and `completed` keys. diff --git a/labs/architecture-examples/backbone.xmpp/js/routers/router.js b/labs/architecture-examples/backbone.xmpp/js/routers/router.js index 4aedc2c318..8379748f8a 100644 --- a/labs/architecture-examples/backbone.xmpp/js/routers/router.js +++ b/labs/architecture-examples/backbone.xmpp/js/routers/router.js @@ -21,6 +21,5 @@ var app = app || {}; }); app.TodoRouter = new Workspace(); - Backbone.history.start(); }());