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