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

maria uses bower for all dependencies.

parent c18448ee
......@@ -3,6 +3,8 @@
"version": "0.0.0",
"dependencies": {
"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
All rights reserved.
Licensed under the Simplified BSD License.
......@@ -78,7 +78,7 @@ aristocrat.removeClass(document.body, 'king');
var re = getRegExp(className);
while (re.test(el.className)) { // in case multiple occurrences
el.className = el.className.replace(re, ' ');
}
}
};
/**
......
......@@ -15,8 +15,8 @@
<script src="bower_components/todomvc-common/base.js"></script>
<script src="bower_components/director/build/director.js"></script>
<script src="lib/maria/maria.js"></script>
<script src="lib/aristocrat/aristocrat.js"></script>
<script src="bower_components/maria-bower/maria.js"></script>
<script src="bower_components/aristocrat-bower/aristocrat.js"></script>
<script src="js/namespace.js"></script>
<script src="js/util.js"></script>
......
......@@ -30,19 +30,31 @@ maria.SetModel.subclass(checkit, 'TodosModel', {
},
getCompleted: function () {
return this.filter(function (todo) {
return todo.isCompleted();
var completeTodos = [];
this.forEach(function (todo) {
if (todo.isCompleted()) {
completeTodos.push(todo);
}
});
return completeTodos;
},
getIncompleted: function () {
return this.filter(function (todo) {
return !todo.isCompleted();
var incompleteTodos = [];
this.forEach(function (todo) {
if (!todo.isCompleted()) {
incompleteTodos.push(todo);
}
});
return incompleteTodos;
},
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 () {
......@@ -62,9 +74,11 @@ maria.SetModel.subclass(checkit, 'TodosModel', {
},
toJSON: function () {
return this.map(function (todo) {
return todo.toJSON();
var todoJSON = [];
this.forEach(function (todo) {
todoJSON.push(todo.toJSON());
});
return todoJSON;
}
}
});
......
......@@ -12,7 +12,7 @@ maria.SetView.subclass(checkit, 'TodosAppView', {
buildData: function () {
var model = this.getModel();
var length = model.length;
var length = model.size;
this.find('#main').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