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

maria uses bower for all dependencies.

parent c18448ee
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"todomvc-common": "~0.1.4", "todomvc-common": "~0.1.4",
"director": "~1.2.0" "director": "~1.2.0",
"maria-bower": "~1.0.0",
"aristocrat-bower": "~1.0.1"
} }
} }
/* /*
Aristocrat version 2 Aristocrat version 1.0.1
Copyright (c) 2012, Peter Michaux Copyright (c) 2012, Peter Michaux
All rights reserved. All rights reserved.
Licensed under the Simplified BSD License. Licensed under the Simplified BSD License.
......
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
<script src="bower_components/todomvc-common/base.js"></script> <script src="bower_components/todomvc-common/base.js"></script>
<script src="bower_components/director/build/director.js"></script> <script src="bower_components/director/build/director.js"></script>
<script src="lib/maria/maria.js"></script> <script src="bower_components/maria-bower/maria.js"></script>
<script src="lib/aristocrat/aristocrat.js"></script> <script src="bower_components/aristocrat-bower/aristocrat.js"></script>
<script src="js/namespace.js"></script> <script src="js/namespace.js"></script>
<script src="js/util.js"></script> <script src="js/util.js"></script>
......
...@@ -30,19 +30,31 @@ maria.SetModel.subclass(checkit, 'TodosModel', { ...@@ -30,19 +30,31 @@ maria.SetModel.subclass(checkit, 'TodosModel', {
}, },
getCompleted: function () { getCompleted: function () {
return this.filter(function (todo) { var completeTodos = [];
return todo.isCompleted(); this.forEach(function (todo) {
if (todo.isCompleted()) {
completeTodos.push(todo);
}
}); });
return completeTodos;
}, },
getIncompleted: function () { getIncompleted: function () {
return this.filter(function (todo) { var incompleteTodos = [];
return !todo.isCompleted(); this.forEach(function (todo) {
if (!todo.isCompleted()) {
incompleteTodos.push(todo);
}
}); });
return incompleteTodos;
}, },
isAllCompleted: function () { isAllCompleted: function () {
return (this.length > 0) && (this.getCompleted().length === this.length); return (this.size > 0) && (this.getCompleted().length === this.size);
},
isEmpty: function () {
return this.size === 0;
}, },
markAllCompleted: function () { markAllCompleted: function () {
...@@ -62,9 +74,11 @@ maria.SetModel.subclass(checkit, 'TodosModel', { ...@@ -62,9 +74,11 @@ maria.SetModel.subclass(checkit, 'TodosModel', {
}, },
toJSON: function () { toJSON: function () {
return this.map(function (todo) { var todoJSON = [];
return todo.toJSON(); this.forEach(function (todo) {
todoJSON.push(todo.toJSON());
}); });
return todoJSON;
} }
} }
}); });
......
...@@ -12,7 +12,7 @@ maria.SetView.subclass(checkit, 'TodosAppView', { ...@@ -12,7 +12,7 @@ maria.SetView.subclass(checkit, 'TodosAppView', {
buildData: function () { buildData: function () {
var model = this.getModel(); var model = this.getModel();
var length = model.length; var length = model.size;
this.find('#main').style.display = (length > 0) ? '' : 'none'; this.find('#main').style.display = (length > 0) ? '' : 'none';
this.find('#footer').style.display = (length > 0) ? '' : 'none'; this.find('#footer').style.display = (length > 0) ? '' : 'none';
......
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