Commit 7f9bd8d4 authored by Stephen McKamey's avatar Stephen McKamey

Applying jscs lint suggestions.

parent 3f420ea0
......@@ -19,5 +19,5 @@
<!-- Hidden if no completed items are left ↓ -->
<button class="clear-completed"
if="<%= data.completed %>"
onclick="<%= todos.actions.clear_click %>">Clear completed</button>
onclick="<%= todos.actions.clearOnClick %>">Clear completed</button>
</footer>
......@@ -4,11 +4,11 @@
<li class="<%= data.completed ? 'completed' : '' %>">
<div class="view">
<input class="toggle" type="checkbox" checked="<%= data.completed %>"
onchange="<%= todos.actions.completed_change(data.id) %>">
<label ondblclick="<%= todos.actions.content_dblclick %>"><%= data.title %></label>
<button class="destroy" onclick="<%= todos.actions.remove_click(data.id) %>"></button>
onchange="<%= todos.actions.completedOnChange(data.id) %>">
<label ondblclick="<%= todos.actions.editOnDblclick %>"><%= data.title %></label>
<button class="destroy" onclick="<%= todos.actions.removeOnClick(data.id) %>"></button>
</div>
<input class="edit" type="text" value="<%= data.title %>"
onblur="<%= todos.actions.edit_blur(data.id) %>"
onkeydown="<%= todos.actions.edit_keypress(data.id) %>">
onblur="<%= todos.actions.editOnBlur(data.id) %>"
onkeydown="<%= todos.actions.editOnKeydown(data.id) %>">
</li>
......@@ -3,7 +3,7 @@
<%-- This section should be hidden by default and shown when there are todos. --%>
<section class="main" if="<%= data.tasks && data.tasks.length %>">
<input class="toggle-all" type="checkbox" checked="<%= !data.stats.active %>"
onchange="<%= todos.actions.toggle_change %>">
onchange="<%= todos.actions.toggleOnChange %>">
<label for="toggle-all">Mark all as complete</label>
<ul class="todo-list">
<for each="<%= data.tasks %>">
......
......@@ -4,7 +4,7 @@
<header class="header">
<h1>todos</h1>
<input class="new-todo" placeholder="What needs to be done?" autofocus
onblur="<%= todos.actions.add_blur %>" onkeydown="<%= todos.actions.add_keypress %>">
onblur="<%= todos.actions.add_blur %>" onkeydown="<%= todos.actions.addOnKeydown %>">
</header>
<call view="Tasks" data="data" />
<call view="Stats" data="data.stats" />
......
......@@ -71,7 +71,7 @@ var todos = todos || {};
// event handlers
todos.actions = {
add_keypress: function (e) {
addOnKeydown: function (e) {
if (e.keyCode === ENTER_KEY) {
add(this);
} else if (e.keyCode === ESC_KEY) {
......@@ -79,14 +79,14 @@ var todos = todos || {};
}
},
edit_blur: function (id) {
editOnBlur: function (id) {
// create a closure around the ID
return function () {
edit(this, id);
};
},
edit_keypress: function (id) {
editOnKeydown: function (id) {
// create a closure around the ID
return function (e) {
if (e.keyCode === ENTER_KEY) {
......@@ -99,7 +99,7 @@ var todos = todos || {};
};
},
remove_click: function (id) {
removeOnClick: function (id) {
// create a closure around the ID
return function () {
todos.model.remove(id);
......@@ -107,37 +107,35 @@ var todos = todos || {};
};
},
clear_click: function () {
clearOnClick: function () {
todos.model.expunge();
refreshView();
},
content_dblclick: function () {
var li = this;
while (li.tagName !== 'LI') {
li = li.parentNode;
editOnDblclick: function () {
var self = this;
while (self.tagName !== 'LI') {
self = self.parentNode;
}
li.className = 'editing';
self.className = 'editing';
var input = find('input[type=text]', li);
var input = find('input[type=text]', self);
if (input) {
input.focus();
}
},
completed_change: function (id) {
completedOnChange: function (id) {
// create a closure around the ID
return function () {
var checkbox = this;
todos.model.toggle(id, checkbox.checked);
todos.model.toggle(id, this.checked);
refreshView();
};
},
toggle_change: function () {
var checkbox = this;
todos.model.toggleAll(checkbox.checked);
toggleOnChange: function () {
todos.model.toggleAll(this.checked);
refreshView();
}
};
......
......@@ -12,7 +12,7 @@
<p>Ported to <a href="http://duelengine.org">DUEL</a> by <a href="http://mck.me">Stephen McKamey</a></p>
<p>Part of <a href="http://todomvc.com">TodoMVC</a></p>
</footer>
<script src="./cdn/0246d47e943708b571e47bd968ef697d343ae178.js"></script>
<script src="./cdn/41614acbac7a243d667ca7ec317c4d0c81ca1d7d.js"></script>
</body>
</html>
\ No newline at end of file
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