Skip to content

Commit

Permalink
Fixes tastejs#305 - bringing lower case consistency to app.Todos
Browse files Browse the repository at this point in the history
  • Loading branch information
addyosmani committed May 31, 2013
1 parent 834b79f commit 0f75cb5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion architecture-examples/backbone/js/collections/todos.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ var app = app || {};
});

// Create our global collection of **Todos**.
app.Todos = new TodoList();
app.todos = new TodoList();
})();
2 changes: 1 addition & 1 deletion architecture-examples/backbone/js/routers/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var app = app || {};

// Trigger a collection filter event, causing hiding/unhiding
// of Todo view items
app.Todos.trigger('filter');
app.todos.trigger('filter');
}
});

Expand Down
30 changes: 15 additions & 15 deletions architecture-examples/backbone/js/views/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,22 @@ var app = app || {};
this.$footer = this.$('#footer');
this.$main = this.$('#main');

this.listenTo(app.Todos, 'add', this.addOne);
this.listenTo(app.Todos, 'reset', this.addAll);
this.listenTo(app.Todos, 'change:completed', this.filterOne);
this.listenTo(app.Todos, 'filter', this.filterAll);
this.listenTo(app.Todos, 'all', this.render);
this.listenTo(app.todos, 'add', this.addOne);
this.listenTo(app.todos, 'reset', this.addAll);
this.listenTo(app.todos, 'change:completed', this.filterOne);
this.listenTo(app.todos, 'filter', this.filterAll);
this.listenTo(app.todos, 'all', this.render);

app.Todos.fetch();
app.todos.fetch();
},

// Re-rendering the App just means refreshing the statistics -- the rest
// of the app doesn't change.
render: function () {
var completed = app.Todos.completed().length;
var remaining = app.Todos.remaining().length;
var completed = app.todos.completed().length;
var remaining = app.todos.remaining().length;

if (app.Todos.length) {
if (app.todos.length) {
this.$main.show();
this.$footer.show();

Expand Down Expand Up @@ -79,22 +79,22 @@ var app = app || {};
// Add all items in the **Todos** collection at once.
addAll: function () {
this.$('#todo-list').html('');
app.Todos.each(this.addOne, this);
app.todos.each(this.addOne, this);
},

filterOne: function (todo) {
todo.trigger('visible');
},

filterAll: function () {
app.Todos.each(this.filterOne, this);
app.todos.each(this.filterOne, this);
},

// Generate the attributes for a new Todo item.
newAttributes: function () {
return {
title: this.$input.val().trim(),
order: app.Todos.nextOrder(),
order: app.todos.nextOrder(),
completed: false
};
},
Expand All @@ -106,20 +106,20 @@ var app = app || {};
return;
}

app.Todos.create(this.newAttributes());
app.todos.create(this.newAttributes());
this.$input.val('');
},

// Clear all completed todo items, destroying their models.
clearCompleted: function () {
_.invoke(app.Todos.completed(), 'destroy');
_.invoke(app.todos.completed(), 'destroy');
return false;
},

toggleAllComplete: function () {
var completed = this.allCheckbox.checked;

app.Todos.each(function (todo) {
app.todos.each(function (todo) {
todo.save({
'completed': completed
});
Expand Down

0 comments on commit 0f75cb5

Please sign in to comment.