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
2a4d9f90
Commit
2a4d9f90
authored
Nov 04, 2013
by
Pascal Hartig
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'pr/711' into gh-pages
Close #711
parents
cf53b0fd
f72e4c1c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
13 deletions
+14
-13
architecture-examples/dart/web/dart/TodoApp.dart
architecture-examples/dart/web/dart/TodoApp.dart
+12
-12
architecture-examples/dart/web/dart/app.dart
architecture-examples/dart/web/dart/app.dart
+2
-1
No files found.
architecture-examples/dart/web/dart/TodoApp.dart
View file @
2a4d9f90
...
...
@@ -3,15 +3,15 @@ part of todomvc;
class
TodoApp
{
List
<
TodoWidget
>
todoWidgets
=
new
List
<
TodoWidget
>();
Element
todoListElement
=
query
(
'#todo-list'
);
Element
mainElement
=
query
(
'#main'
);
InputElement
checkAllCheckboxElement
=
query
(
'#toggle-all'
);
Element
footerElement
=
query
(
'#footer'
);
Element
countElement
=
query
(
'#todo-count'
);
Element
clearCompletedElement
=
query
(
'#clear-completed'
);
Element
showAllElement
=
query
(
'#filters a[href="#/"]'
);
Element
showActiveElement
=
query
(
'#filters a[href="#/active"]'
);
Element
showCompletedElement
=
query
(
'#filters a[href="#/completed"]'
);
Element
todoListElement
=
query
Selector
(
'#todo-list'
);
Element
mainElement
=
query
Selector
(
'#main'
);
InputElement
checkAllCheckboxElement
=
query
Selector
(
'#toggle-all'
);
Element
footerElement
=
query
Selector
(
'#footer'
);
Element
countElement
=
query
Selector
(
'#todo-count'
);
Element
clearCompletedElement
=
query
Selector
(
'#clear-completed'
);
Element
showAllElement
=
query
Selector
(
'#filters a[href="#/"]'
);
Element
showActiveElement
=
query
Selector
(
'#filters a[href="#/active"]'
);
Element
showCompletedElement
=
query
Selector
(
'#filters a[href="#/completed"]'
);
TodoApp
()
{
initLocalStorage
();
...
...
@@ -26,7 +26,7 @@ class TodoApp {
var
jsonList
=
window
.
localStorage
[
'todos-vanilladart'
];
if
(
jsonList
!=
null
)
{
try
{
var
todos
=
JSON
.
pars
e
(
jsonList
);
var
todos
=
JSON
.
decod
e
(
jsonList
);
for
(
Map
todo
in
todos
)
{
addTodo
(
new
Todo
.
fromJson
(
todo
));
}
...
...
@@ -37,7 +37,7 @@ class TodoApp {
}
void
initElementEventListeners
()
{
InputElement
newTodoElement
=
query
(
'#new-todo'
);
InputElement
newTodoElement
=
query
Selector
(
'#new-todo'
);
newTodoElement
.
onKeyPress
.
listen
((
KeyboardEvent
e
)
{
if
(
e
.
keyCode
==
KeyCode
.
ENTER
)
{
...
...
@@ -160,6 +160,6 @@ class TodoApp {
for
(
TodoWidget
todoWidget
in
todoWidgets
)
{
todos
.
add
(
todoWidget
.
todo
);
}
window
.
localStorage
[
'todos-vanilladart'
]
=
JSON
.
stringify
(
todos
);
window
.
localStorage
[
'todos-vanilladart'
]
=
JSON
.
encode
(
todos
);
}
}
architecture-examples/dart/web/dart/app.dart
View file @
2a4d9f90
...
...
@@ -2,7 +2,7 @@ library todomvc;
import
'dart:html'
;
import
'dart:math'
;
import
'dart:
json'
as
JSON
;
import
'dart:
convert'
;
part
'TodoWidget.dart'
;
part
'TodoApp.dart'
;
...
...
@@ -24,6 +24,7 @@ class Todo {
completed
=
json
[
'completed'
];
}
// this is automatically called by JSON.encode
Map
toJson
()
{
return
{
'id'
:
id
,
'title'
:
title
,
'completed'
:
completed
};
}
...
...
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