Commit d95b22b7 authored by Fred Wu's avatar Fred Wu

Blank entries should not be added

parent 488ddc31
...@@ -13,6 +13,10 @@ ...@@ -13,6 +13,10 @@
Task.extend(Spine.Model.Local); Task.extend(Spine.Model.Local);
Task.prototype.validate = function() {
if (!$.trim(this.name)) return 'Task name is required';
};
Task.active = function() { Task.active = function() {
return this.select(function(task) { return this.select(function(task) {
return !task.done; return !task.done;
......
...@@ -2,6 +2,9 @@ class window.Task extends Spine.Model ...@@ -2,6 +2,9 @@ class window.Task extends Spine.Model
@configure 'Task', 'name', 'done' @configure 'Task', 'name', 'done'
@extend Spine.Model.Local @extend Spine.Model.Local
validate: ->
'Task name is required' unless $.trim(@name)
@active: -> @active: ->
@select (task) -> !task.done @select (task) -> !task.done
......
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