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