Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
todomvc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sven Franck
todomvc
Commits
4cab0659
Commit
4cab0659
authored
Jul 01, 2012
by
addyosmani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Completing routing changes.
parent
9fd0c4f7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
11 deletions
+16
-11
architecture-examples/backbone/js/app.js
architecture-examples/backbone/js/app.js
+16
-11
No files found.
architecture-examples/backbone/js/app.js
View file @
4cab0659
// 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
(
current
Filter
){
switch
(
Todo
Filter
){
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
'
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment