Commit 2ec5dc11 authored by Stephen Sawchuk's avatar Stephen Sawchuk

fix spine .focus() spec deviation.

parent 92328d50
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.6.3
(function() {
var TodoApp,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
......@@ -33,7 +33,8 @@
this.renderFooter = __bind(this.renderFooter, this);
this.toggleElems = __bind(this.toggleElems, this);
this.addAll = __bind(this.addAll, this);
this.addNew = __bind(this.addNew, this); TodoApp.__super__.constructor.apply(this, arguments);
this.addNew = __bind(this.addNew, this);
TodoApp.__super__.constructor.apply(this, arguments);
Todo.bind('create', this.addNew);
Todo.bind('refresh change', this.addAll);
Todo.bind('refresh change', this.toggleElems);
......@@ -54,7 +55,6 @@
TodoApp.prototype["new"] = function(e) {
var val;
val = $.trim(this.newTodoInput.val());
if (e.which === ENTER_KEY && val) {
Todo.create({
......@@ -77,7 +77,6 @@
TodoApp.prototype.addNew = function(todo) {
var view;
view = new Todos({
todo: todo
});
......@@ -86,7 +85,6 @@
TodoApp.prototype.addAll = function() {
var todo, _i, _len, _ref, _results;
this.todos.empty();
_ref = this.getByFilter();
_results = [];
......@@ -103,6 +101,7 @@
TODO: Model updateAttribute sometimes won't stick:
https://github.com/maccman/spine/issues/219
*/
todo.updateAttribute('completed', e.target.checked);
return todo.trigger('update', todo);
});
......@@ -114,7 +113,6 @@
TodoApp.prototype.toggleElems = function() {
var isTodos;
isTodos = !!Todo.count();
this.main.toggle(isTodos);
this.footer.toggle(isTodos);
......@@ -126,7 +124,6 @@
TodoApp.prototype.renderFooter = function() {
var active, completed, text;
text = function(count) {
if (count === 1) {
return 'item';
......
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.6.3
(function() {
var __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
__hasProp = {}.hasOwnProperty,
......@@ -26,7 +26,8 @@
};
function Todos() {
this.render = __bind(this.render, this); Todos.__super__.constructor.apply(this, arguments);
this.render = __bind(this.render, this);
Todos.__super__.constructor.apply(this, arguments);
this.todo.bind('update', this.render);
this.todo.bind('destroy', this.release);
}
......@@ -46,12 +47,11 @@
Todos.prototype.edit = function() {
this.el.addClass('editing');
return this.editElem.focus();
return this.editElem.val(this.editElem.val()).focus();
};
Todos.prototype.finishEdit = function() {
var val;
this.el.removeClass('editing');
val = $.trim(this.editElem.val());
if (val) {
......
// Generated by CoffeeScript 1.6.2
// Generated by CoffeeScript 1.6.3
(function() {
var _ref,
__hasProp = {}.hasOwnProperty,
......@@ -30,7 +30,6 @@
Todo.destroyCompleted = function() {
var todo, _i, _len, _ref1, _results;
_ref1 = this.completed();
_results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
......
......@@ -29,7 +29,7 @@ class window.Todos extends Spine.Controller
edit: ->
@el.addClass 'editing'
@editElem.focus()
@editElem.val(@editElem.val()).focus()
finishEdit: ->
@el.removeClass 'editing'
......
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