Commit fdc05921 authored by Sindre Sorhus's avatar Sindre Sorhus

Dart app: minor tweaks

parent ae8c6a13
......@@ -23,7 +23,7 @@ class TodoApp {
}
void initLocalStorage() {
var jsonList = window.localStorage["todos-vanilladart"];
var jsonList = window.localStorage['todos-vanilladart'];
if (jsonList != null) {
try {
var todos = JSON.parse(jsonList);
......@@ -31,7 +31,7 @@ class TodoApp {
addTodo(new Todo.fromJson(todo));
}
} catch (e) {
window.console.log("Could not load todos form local storage.");
window.console.log('Could not load todos form local storage.');
}
}
}
......@@ -84,15 +84,10 @@ class TodoApp {
}
void updateFooterDisplay() {
if (todoWidgets.length == 0) {
checkAllCheckboxElement.style.display = 'none';
mainElement.style.display = 'none';
footerElement.style.display = 'none';
} else {
checkAllCheckboxElement.style.display = 'block';
mainElement.style.display = 'block';
footerElement.style.display = 'block';
}
var display = todoWidgets.length == 0 ? 'none' : 'block';
checkAllCheckboxElement.style.display = display;
mainElement.style.display = display;
footerElement.style.display = display;
updateCounts();
}
......@@ -165,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.stringify(todos);
}
}
......@@ -10,14 +10,14 @@ class TodoWidget {
Element createElement() {
element = new Element.html('''
<li ${todo.completed ? 'class="completed"' : ''}>
<div class='view'>
<input class='toggle' type='checkbox' ${todo.completed ? 'checked' : ''}>
<label class='todo-content'>${todo.title}</label>
<button class='destroy'></button>
</div>
<input class='edit' value='${todo.title}'>
</li>
<li ${todo.completed ? 'class="completed"' : ''}>
<div class='view'>
<input class='toggle' type='checkbox' ${todo.completed ? 'checked' : ''}>
<label class='todo-content'>${todo.title}</label>
<button class='destroy'></button>
</div>
<input class='edit' value='${todo.title}'>
</li>
''');
Element contentElement = element.query('.todo-content');
......@@ -71,11 +71,7 @@ class TodoWidget {
}
void set visible(bool visible) {
if (visible) {
element.style.display = 'block';
} else {
element.style.display = 'none';
}
element.style.display = visible ? 'block' : 'none';
}
void toggle() {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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