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
Eugene Shen
todomvc
Commits
3b725068
Commit
3b725068
authored
Jan 02, 2012
by
Aaron Boushley
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Got the binding for the clear completed visibility figured out using a global binding.
parent
2326f6bc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
todo-example/emberjs/index.html
todo-example/emberjs/index.html
+2
-2
todo-example/emberjs/js/app.js
todo-example/emberjs/js/app.js
+5
-4
No files found.
todo-example/emberjs/index.html
View file @
3b725068
...
@@ -50,8 +50,8 @@
...
@@ -50,8 +50,8 @@
{{
/view}
}
{{
/view}
}
<!--
Insert
this
after
the
CreateTodoView
and
before
the
collection
.
-->
<!--
Insert
this
after
the
CreateTodoView
and
before
the
collection
.
-->
{{
#
view
Todos
.
StatsView
id
=
"
todo-stats
"
}}
{{
#
view
Todos
.
StatsView
id
=
"
todo-stats
"
content
=
this
}}
{{
#
view
Ember
.
Button
target
=
"
Todos.todosController
"
action
=
"
clearCompletedTodos
"
content
=
this
}}
{{
#
view
Ember
.
Button
target
=
"
Todos.todosController
"
action
=
"
clearCompletedTodos
"
c
lassNameBindings
=
"
Todos.todosController.completeClass
"
c
ontent
=
this
}}
Clear
{{
content
.
completedString
}}
Clear
{{
content
.
completedString
}}
{{
/view}
}
{{
/view}
}
{{
remainingString
}}
left
{{
remainingString
}}
left
...
...
todo-example/emberjs/js/app.js
View file @
3b725068
...
@@ -52,6 +52,10 @@ Todos.todosController = Ember.ArrayProxy.create({
...
@@ -52,6 +52,10 @@ Todos.todosController = Ember.ArrayProxy.create({
}
else
{
}
else
{
return
!!
this
.
get
(
'
length
'
)
&&
this
.
everyProperty
(
'
isDone
'
,
true
);
return
!!
this
.
get
(
'
length
'
)
&&
this
.
everyProperty
(
'
isDone
'
,
true
);
}
}
}.
property
(
'
@each.isDone
'
),
completeClass
:
function
()
{
return
this
.
get
(
'
completed
'
)
<
1
?
'
none-completed
'
:
'
some-completed
'
;
}.
property
(
'
@each.isDone
'
)
}.
property
(
'
@each.isDone
'
)
});
});
...
@@ -66,10 +70,7 @@ Todos.StatsView = Ember.View.extend({
...
@@ -66,10 +70,7 @@ Todos.StatsView = Ember.View.extend({
completedString
:
function
()
{
completedString
:
function
()
{
var
completed
=
this
.
get
(
'
completed
'
);
var
completed
=
this
.
get
(
'
completed
'
);
return
completed
+
"
completed
"
+
(
completed
===
1
?
"
item
"
:
"
items
"
);
return
completed
+
"
completed
"
+
(
completed
===
1
?
"
item
"
:
"
items
"
);
}.
property
(
'
completed
'
),
}.
property
(
'
completed
'
)
updateCompletedButton
:
function
()
{
$
(
'
#todo-stats button
'
).
toggleClass
(
'
none-completed
'
,
this
.
get
(
'
completed
'
)
<
1
);
}.
observes
(
'
completed
'
)
});
});
Todos
.
CreateTodoView
=
Ember
.
TextField
.
extend
({
Todos
.
CreateTodoView
=
Ember
.
TextField
.
extend
({
...
...
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