Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
8 changes: 6 additions & 2 deletions js/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var app = app || {};
app.ALL_TODOS = 'all';
app.ACTIVE_TODOS = 'active';
app.COMPLETED_TODOS = 'completed';
app.HOME_TODOS = 'home';
var TodoFooter = app.TodoFooter;
var TodoItem = app.TodoItem;

Expand All @@ -30,7 +31,8 @@ var app = app || {};
var router = Router({
'/': setState.bind(this, {nowShowing: app.ALL_TODOS}),
'/active': setState.bind(this, {nowShowing: app.ACTIVE_TODOS}),
'/completed': setState.bind(this, {nowShowing: app.COMPLETED_TODOS})
'/completed': setState.bind(this, {nowShowing: app.COMPLETED_TODOS}),
'/home': setState.bind(this, {nowShowing: app.HOME_TODOS})
});
router.init('/');
},
Expand Down Expand Up @@ -91,8 +93,10 @@ var app = app || {};

var shownTodos = todos.filter(function (todo) {
switch (this.state.nowShowing) {
case app.HOME_TODOS:
return todo.title.split(':')[0] === 'home';
case app.ACTIVE_TODOS:
return !todo.completed;
return todo.completed;
case app.COMPLETED_TODOS:
return todo.completed;
default:
Expand Down
8 changes: 8 additions & 0 deletions js/footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ var app = app || {};
Completed
</a>
</li>
{' '}
<li>
<a
href="#/home"
className={classNames({selected: nowShowing === app.HOME_TODOS})}>
Home
</a>
</li>
</ul>
{clearButton}
</footer>
Expand Down