Commit 46d92d77 authored by Sindre Sorhus's avatar Sindre Sorhus

Merge pull request #1208 from MathieuLorber/dart-v1.0.1-format

New formatter on all vanilladart code
parents 02be0b3a cbbdbae6
......@@ -5,7 +5,7 @@ class Todo {
String title;
bool completed;
Todo(this.id, this.title, {this.completed : false});
Todo(this.id, this.title, {this.completed: false});
Todo.fromJson(Map json) {
id = json['id'];
......@@ -15,10 +15,6 @@ class Todo {
// this is automatically called by JSON.encode
Map toJson() {
return {
'id': id,
'title': title,
'completed': completed
};
return {'id': id, 'title': title, 'completed': completed};
}
}
part of todomvc;
class TodoApp {
List<TodoWidget> todoWidgets = new List<TodoWidget>();
Element todoListElement = querySelector('#todo-list');
......@@ -12,7 +11,8 @@ class TodoApp {
Element clearCompletedElement = querySelector('#clear-completed');
Element showAllElement = querySelector('#filters a[href="#/"]');
Element showActiveElement = querySelector('#filters a[href="#/active"]');
Element showCompletedElement = querySelector('#filters a[href="#/completed"]');
Element showCompletedElement =
querySelector('#filters a[href="#/completed"]');
TodoApp() {
initLocalStorage();
......@@ -93,7 +93,8 @@ class TodoApp {
var complete = todoWidgets.where((w) => w.todo.completed).length;
checkAllCheckboxElement.checked = (complete == todoWidgets.length);
var left = todoWidgets.length - complete;
countElement.innerHtml = '<strong>$left</strong> item${left != 1 ? 's' : ''} left';
countElement.innerHtml =
'<strong>$left</strong> item${left != 1 ? 's' : ''} left';
if (complete == 0) {
clearCompletedElement.style.display = 'none';
} else {
......@@ -108,7 +109,7 @@ class TodoApp {
}
void updateFilter() {
switch(window.location.hash) {
switch (window.location.hash) {
case '#/active':
showActive();
break;
......
part of todomvc;
class TodoWidget {
static const HtmlEscape htmlEscape = const HtmlEscape();
TodoApp todoApp;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment