Commit 4cab0659 authored by addyosmani's avatar addyosmani

Completing routing changes.

parent 9fd0c4f7
// Load the application once the DOM is ready, using `jQuery.ready`:
$(function(){
var currentFilter = "";
// Todo Model
// ----------
......@@ -73,6 +71,10 @@ $(function(){
// Create our global collection of **Todos**.
var Todos = new TodoList;
// Todo Filter (active || completed || "")
var TodoFilter = "";
// Todo Item View
// --------------
......@@ -198,6 +200,13 @@ $(function(){
completed: completed,
remaining: remaining
}));
this.$('#filters li a')
.removeClass('selected')
.filter("[href='#/" + TodoFilter + "']")
.addClass('selected');
} else {
this.$main.hide();
......@@ -219,7 +228,7 @@ $(function(){
this.$("#todo-list").html('');
switch(currentFilter){
switch(TodoFilter){
case "active":
_.each(Todos.remaining(), this.addOne);
break;
......@@ -275,15 +284,11 @@ $(function(){
setFilter: function(param){
currentFilter = param;
Todos.trigger('reset');
// Currently not working on navigation.
$('#filters li a')
.removeClass('selected')
.filter("[href='#/" + param + "']")
.addClass('selected');
// Set the current filter to be used
TodoFilter = param || "";
// Trigger a collection reset/addAll
Todos.trigger('reset');
}
......
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