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
c1cfbfa8
Commit
c1cfbfa8
authored
May 13, 2012
by
Sindre Sorhus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Spine: Fix todos not updating when checked while on a route
parent
b47026fd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
10 deletions
+28
-10
architecture-examples/spine/js/app.js
architecture-examples/spine/js/app.js
+13
-4
architecture-examples/spine/js/controllers/todos.js
architecture-examples/spine/js/controllers/todos.js
+9
-3
architecture-examples/spine/js/models/todo.js
architecture-examples/spine/js/models/todo.js
+5
-2
architecture-examples/spine/src/app.coffee
architecture-examples/spine/src/app.coffee
+1
-1
No files found.
architecture-examples/spine/js/app.js
View file @
c1cfbfa8
// Generated by CoffeeScript 1.3.1
(
function
()
{
var
TodoApp
,
__bind
=
function
(
fn
,
me
){
return
function
(){
return
fn
.
apply
(
me
,
arguments
);
};
},
__hasProp
=
Object
.
prototype
.
hasOwnProperty
,
__hasProp
=
{}
.
hasOwnProperty
,
__extends
=
function
(
child
,
parent
)
{
for
(
var
key
in
parent
)
{
if
(
__hasProp
.
call
(
parent
,
key
))
child
[
key
]
=
parent
[
key
];
}
function
ctor
()
{
this
.
constructor
=
child
;
}
ctor
.
prototype
=
parent
.
prototype
;
child
.
prototype
=
new
ctor
;
child
.
__super__
=
parent
.
prototype
;
return
child
;
};
TodoApp
=
(
function
(
_super
)
{
...
...
@@ -9,6 +10,8 @@
__extends
(
TodoApp
,
_super
);
TodoApp
.
name
=
'
TodoApp
'
;
ENTER_KEY
=
13
;
TodoApp
.
prototype
.
elements
=
{
...
...
@@ -30,11 +33,15 @@
function
TodoApp
()
{
this
.
renderFooter
=
__bind
(
this
.
renderFooter
,
this
);
this
.
toggleElems
=
__bind
(
this
.
toggleElems
,
this
);
this
.
addAll
=
__bind
(
this
.
addAll
,
this
);
this
.
addNew
=
__bind
(
this
.
addNew
,
this
);
TodoApp
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
this
.
addNew
=
__bind
(
this
.
addNew
,
this
);
TodoApp
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
Todo
.
bind
(
'
create
'
,
this
.
addNew
);
Todo
.
bind
(
'
refresh
'
,
this
.
addAll
);
Todo
.
bind
(
'
refresh
change
'
,
this
.
addAll
);
Todo
.
bind
(
'
refresh change
'
,
this
.
toggleElems
);
Todo
.
bind
(
'
refresh change
'
,
this
.
renderFooter
);
Todo
.
fetch
();
...
...
@@ -44,6 +51,7 @@
/*
TODO: Need to figure out why the route doesn't trigger `change` event
*/
Todo
.
trigger
(
'
refresh
'
);
return
this
.
filters
.
removeClass
(
'
selected
'
).
filter
(
"
[href='#/
"
+
this
.
filter
+
"
']
"
).
addClass
(
'
selected
'
);
}
...
...
@@ -97,7 +105,8 @@
/*
TODO: Model updateAttribute sometimes won't stick:
https://github.com/maccman/spine/issues/219
*/
todo
.
updateAttribute
(
'
completed
'
,
e
.
target
.
checked
);
*/
todo
.
updateAttribute
(
'
completed
'
,
e
.
target
.
checked
);
return
todo
.
trigger
(
'
update
'
,
todo
);
});
};
...
...
architecture-examples/spine/js/controllers/todos.js
View file @
c1cfbfa8
// Generated by CoffeeScript 1.3.1
(
function
()
{
var
__bind
=
function
(
fn
,
me
){
return
function
(){
return
fn
.
apply
(
me
,
arguments
);
};
},
__hasProp
=
Object
.
prototype
.
hasOwnProperty
,
__hasProp
=
{}
.
hasOwnProperty
,
__extends
=
function
(
child
,
parent
)
{
for
(
var
key
in
parent
)
{
if
(
__hasProp
.
call
(
parent
,
key
))
child
[
key
]
=
parent
[
key
];
}
function
ctor
()
{
this
.
constructor
=
child
;
}
ctor
.
prototype
=
parent
.
prototype
;
child
.
prototype
=
new
ctor
;
child
.
__super__
=
parent
.
prototype
;
return
child
;
};
window
.
Todos
=
(
function
(
_super
)
{
...
...
@@ -8,6 +9,8 @@
__extends
(
Todos
,
_super
);
Todos
.
name
=
'
Todos
'
;
ENTER_KEY
=
13
;
TPL
=
Handlebars
.
compile
(
$
(
'
#todo-template
'
).
html
());
...
...
@@ -25,7 +28,8 @@
};
function
Todos
()
{
this
.
render
=
__bind
(
this
.
render
,
this
);
Todos
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
this
.
render
=
__bind
(
this
.
render
,
this
);
Todos
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
this
.
todo
.
bind
(
'
update
'
,
this
.
render
);
this
.
todo
.
bind
(
'
destroy
'
,
this
.
release
);
}
...
...
@@ -60,7 +64,9 @@
};
Todos
.
prototype
.
finishEditOnEnter
=
function
(
e
)
{
if
(
e
.
which
===
ENTER_KEY
)
return
this
.
finishEdit
();
if
(
e
.
which
===
ENTER_KEY
)
{
return
this
.
finishEdit
();
}
};
return
Todos
;
...
...
architecture-examples/spine/js/models/todo.js
View file @
c1cfbfa8
// Generated by CoffeeScript 1.3.1
(
function
()
{
var
__hasProp
=
Object
.
prototype
.
hasOwnProperty
,
var
__hasProp
=
{}
.
hasOwnProperty
,
__extends
=
function
(
child
,
parent
)
{
for
(
var
key
in
parent
)
{
if
(
__hasProp
.
call
(
parent
,
key
))
child
[
key
]
=
parent
[
key
];
}
function
ctor
()
{
this
.
constructor
=
child
;
}
ctor
.
prototype
=
parent
.
prototype
;
child
.
prototype
=
new
ctor
;
child
.
__super__
=
parent
.
prototype
;
return
child
;
};
window
.
Todo
=
(
function
(
_super
)
{
__extends
(
Todo
,
_super
);
Todo
.
name
=
'
Todo
'
;
function
Todo
()
{
Todo
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
return
Todo
.
__super__
.
constructor
.
apply
(
this
,
arguments
);
}
Todo
.
configure
(
'
Todo
'
,
'
title
'
,
'
completed
'
);
...
...
architecture-examples/spine/src/app.coffee
View file @
c1cfbfa8
...
...
@@ -19,7 +19,7 @@ class TodoApp extends Spine.Controller
constructor
:
->
super
Todo
.
bind
'create'
,
@
addNew
Todo
.
bind
'refresh'
,
@
addAll
Todo
.
bind
'refresh
change
'
,
@
addAll
Todo
.
bind
'refresh change'
,
@
toggleElems
Todo
.
bind
'refresh change'
,
@
renderFooter
Todo
.
fetch
()
...
...
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