Skip to content

Commit

Permalink
Do things in the right order, after we are connected to XMPP
Browse files Browse the repository at this point in the history
  • Loading branch information
Yiorgis Gozadinos committed Aug 11, 2012
1 parent 4e69239 commit be80729
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion labs/architecture-examples/backbone.xmpp/index.html
Expand Up @@ -56,7 +56,7 @@ <h1>todos</h1>
<script src="../../../assets/jquery.min.js"></script>
<script src="../../../architecture-examples/backbone/js/lib/underscore-min.js"></script>
<script src="../../../architecture-examples/backbone/js/lib/backbone-min.js"></script>
<script src="js/lib/strophe.min.js"></script>
<script src="js/lib/strophe.js"></script>
<script src="js/lib/strophe.forms.js"></script>
<script src="js/lib/strophe.pubsub.js"></script>
<script src="js/lib/backbone.xmpp.storage.js"></script>
Expand Down
5 changes: 4 additions & 1 deletion 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();
};
Expand Down Expand Up @@ -44,7 +48,6 @@ $(function() {
cp.always(function () {
app.start();
});

}
});

Expand Down
Expand Up @@ -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 ) {
Expand Down Expand Up @@ -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();

}());
2 changes: 1 addition & 1 deletion labs/architecture-examples/backbone.xmpp/js/models/todo.js
Expand Up @@ -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.
Expand Down
Expand Up @@ -21,6 +21,5 @@ var app = app || {};
});

app.TodoRouter = new Workspace();
Backbone.history.start();

}());

0 comments on commit be80729

Please sign in to comment.