Commit af1fbbe1 authored by Sindre Sorhus's avatar Sindre Sorhus

CanJS + RequireJS: code style and changelog

parent 11f1ca56
......@@ -9,6 +9,7 @@
- Updates since 1.2:
- CanJS 2.0
- CanJS 2.0 + RequireJS
## 1.2 - 2013-08-06
......
{
"name": "todomvc-canjs_require",
"name": "todomvc-canjs-require",
"version": "0.0.0",
"dependencies": {
"todomvc-common": "~0.1.6",
......
......@@ -7,8 +7,7 @@
<link rel="stylesheet" href="bower_components/todomvc-common/base.css">
</head>
<body>
<section id="todoapp">
</section>
<section id="todoapp"></section>
<footer id="info">
<p>Double-click to edit a todo</p>
<p>Written by <a href="http://bitovi.com">Bitovi</a></p>
......@@ -37,7 +36,6 @@
{{/each}}
</ul>
</section>
<footer id="footer" class="{{^if todos.length}}hidden{{/if}}">
<span id="todo-count">
<strong>{{todos.remaining}}</strong> {{plural "item" todos.remaining}} left
......
/* global define */
define(['can/util/library', 'can/component', '../models/Todo', 'can/route'], function (can, Component, Todo, route) {
define([
'can/util/library',
'can/component',
'../models/Todo',
'can/route'
], function (can, Component, Todo, route) {
'use strict';
var ESCAPE_KEY = 27;
return Component.extend({
// Create this component on a tag like `<todo-app>`.
// Create this component on a tag like `<todo-app>`
tag: 'todo-app',
scope: {
// Store the Todo model in the scope
......@@ -17,8 +22,8 @@ define(['can/util/library', 'can/component', '../models/Todo', 'can/route'], fun
todo.attr('editing', true);
el.parents('.todo').find('.edit').focus();
},
cancelEditing: function (todo, el, ev) {
if (ev.which === ESCAPE_KEY) {
cancelEditing: function (todo, el, e) {
if (e.which === ESCAPE_KEY) {
el.val(todo.attr('text'));
todo.attr('editing', false);
}
......
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