Commit 0f75cb53 authored by Addy Osmani's avatar Addy Osmani

Fixes #305 - bringing lower case consistency to app.Todos

parent 834b79f6
......@@ -44,5 +44,5 @@ var app = app || {};
});
// Create our global collection of **Todos**.
app.Todos = new TodoList();
app.todos = new TodoList();
})();
......@@ -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');
}
});
......
......@@ -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();
......@@ -79,7 +79,7 @@ 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) {
......@@ -87,14 +87,14 @@ var app = app || {};
},
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
};
},
......@@ -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
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment