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
6a8987ed
Commit
6a8987ed
authored
Feb 29, 2012
by
Christoph Burgdorf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bound "mark all as complete"
parent
500a7d48
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
20 deletions
+13
-20
architecture-examples/angularjs/index_new.html
architecture-examples/angularjs/index_new.html
+4
-2
architecture-examples/angularjs/js/controllers.js
architecture-examples/angularjs/js/controllers.js
+9
-18
No files found.
architecture-examples/angularjs/index_new.html
View file @
6a8987ed
...
...
@@ -18,7 +18,7 @@
</header>
<!-- TODO: figure out if its spec compliant to remove the #main id if its getting into the way?-->
<section
id=
"main"
ng:show=
"hasTodos()"
>
<input
id=
"toggle-all"
type=
"checkbox"
>
<input
id=
"toggle-all"
type=
"checkbox"
name=
"allChecked"
ng:click=
"toggleAllStates()"
>
<label
for=
"toggle-all"
>
Mark all as complete
</label>
<ul
id=
"todo-list"
>
<li
ng:repeat=
"todo in todos"
my:dblclick=
"editTodo(todo)"
ng:class=
"(todo.done && ' done ') + (todo.editing && ' editing ')"
>
...
...
@@ -27,7 +27,9 @@
<label>
{{ todo.content }}
</label>
<a
class=
"destroy"
ng:click=
"removeTodo(todo)"
></a>
</div>
<input
class=
"edit"
type=
"text"
name=
"todo.content"
>
<form
ng:submit=
"finishEditing(todo)"
>
<input
class=
"edit"
type=
"text"
name=
"todo.content"
my:focus=
"todo.editing"
my:blur=
"finishEditing(todo)"
>
</form>
</li>
</ul>
</section>
...
...
architecture-examples/angularjs/js/controllers.js
View file @
6a8987ed
...
...
@@ -44,7 +44,7 @@ App.Controllers.TodoController = function () {
var
pluralize
=
function
(
count
,
word
)
{
return
count
===
1
?
word
:
word
+
'
s
'
;
}
}
;
self
.
remainingTodos
=
countTodos
(
"
undone
"
);
...
...
@@ -57,7 +57,7 @@ App.Controllers.TodoController = function () {
self
.
clearItemsText
=
function
(){
var
finishedTodos
=
self
.
finishedTodos
();
return
'
Clear
'
+
finishedTodos
+
'
completed
'
+
pluralize
(
finishedTodos
,
'
item
'
);
}
}
;
self
.
clearCompletedItems
=
function
()
{
var
oldTodos
=
self
.
todos
;
...
...
@@ -67,6 +67,12 @@ App.Controllers.TodoController = function () {
});
};
self
.
toggleAllStates
=
function
(){
angular
.
forEach
(
self
.
todos
,
function
(
todo
){
todo
.
done
=
self
.
allChecked
;
})
};
self
.
hasFinishedTodos
=
function
()
{
return
self
.
finishedTodos
()
>
0
;
};
...
...
@@ -74,19 +80,4 @@ App.Controllers.TodoController = function () {
self
.
hasTodos
=
function
()
{
return
self
.
todos
.
length
>
0
;
};
/*
The following code deals with hiding the hint *while* you are typing,
showing it once you did *finish* typing (aka 500 ms since you hit the last key)
*in case* the result is a non empty string
*/
Rx
.
Observable
.
FromAngularScope
(
self
,
"
newTodo
"
)
.
Do
(
function
()
{
self
.
showHitEnterHint
=
false
;
})
.
Throttle
(
500
)
.
Select
(
function
(
x
)
{
return
x
.
length
>
0
;
})
.
ToOutputProperty
(
self
,
"
showHitEnterHint
"
);
};
\ No newline at end of file
};
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