Commit 5eb4dbbb authored by Duilio Protti's avatar Duilio Protti

#817 Batman - trim title

parent 9017b22b
......@@ -24,7 +24,7 @@ class Alfred.TodosController extends Batman.Controller
class Alfred.TodosIndexView extends Batman.View
createTodo: (node, event, context) ->
event.preventDefault()
title = node[0].value
title = node[0].value.trim()
if title
newTodo = new Alfred.Todo(title: title, completed: false)
newTodo.save (err) ->
......@@ -79,8 +79,8 @@ class Alfred.Todo extends Batman.Model
@encode 'title', 'completed'
@validate 'title', presence: true
@classAccessor 'default', ->
@get('all').filter (todo) -> true
@classAccessor 'default', ->
@get('all').filter (todo) -> true
@classAccessor 'active', ->
@get('all').filter (todo) -> !todo.get('completed')
......
// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.7.1
(function() {
var Alfred, _ref, _ref1, _ref2, _ref3,
var Alfred,
__hasProp = {}.hasOwnProperty,
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
......@@ -8,8 +8,7 @@
__extends(Alfred, _super);
function Alfred() {
_ref = Alfred.__super__.constructor.apply(this, arguments);
return _ref;
return Alfred.__super__.constructor.apply(this, arguments);
}
Alfred.root('todos#index', {
......@@ -62,14 +61,13 @@
__extends(TodosIndexView, _super);
function TodosIndexView() {
_ref1 = TodosIndexView.__super__.constructor.apply(this, arguments);
return _ref1;
return TodosIndexView.__super__.constructor.apply(this, arguments);
}
TodosIndexView.prototype.createTodo = function(node, event, context) {
var newTodo, title;
event.preventDefault();
title = node[0].value;
title = node[0].value.trim();
if (title) {
newTodo = new Alfred.Todo({
title: title,
......@@ -133,8 +131,7 @@
__extends(TodosActiveView, _super);
function TodosActiveView() {
_ref2 = TodosActiveView.__super__.constructor.apply(this, arguments);
return _ref2;
return TodosActiveView.__super__.constructor.apply(this, arguments);
}
return TodosActiveView;
......@@ -145,8 +142,7 @@
__extends(TodosCompletedView, _super);
function TodosCompletedView() {
_ref3 = TodosCompletedView.__super__.constructor.apply(this, arguments);
return _ref3;
return TodosCompletedView.__super__.constructor.apply(this, arguments);
}
return TodosCompletedView;
......
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