Permalink
Browse files

update to maria.js release candidate 1

  • Loading branch information...
petermichaux committed Jul 7, 2012
1 parent 8f374e8 commit 9448fd8f99d250b6a6e9f7738ab6e17e2dc9e354
@@ -1656,7 +1656,7 @@ hormigas.ObjectSet.mixin = function(obj) {
hormigas.ObjectSet.call(obj);
};
/*
Maria version 0 - an MVC framework for JavaScript applications
Maria release candidate 1 - an MVC framework for JavaScript applications
Copyright (c) 2012, Peter Michaux
All rights reserved.
Licensed under the Simplified BSD License.
@@ -2215,14 +2215,16 @@ will automatically call your "initialize" method.
*/
maria.View = function(model, controller) {
maria.Node.call(this);
this.initialize();
this.setModel(model);
this.setController(controller);
this.initialize();
};
maria.Node.mixin(maria.View.prototype);
maria.View.prototype.initialize = function() {};
maria.View.prototype.initialize = function() {
// to be overridden by concrete view subclasses
};
maria.View.prototype.destroy = function() {
maria.purgeEventListener(this);
@@ -2472,15 +2474,23 @@ the same.
*/
maria.ElementView = function(model, controller, doc) {
this._doc = doc || document;
maria.View.call(this, model, controller);
this.setDocument(doc);
};
maria.ElementView.prototype = new maria.View();
maria.ElementView.prototype.constructor = maria.ElementView;
maria.ElementView.prototype.getDocument = function() {
return this._doc;
return this._doc || document;
};
maria.ElementView.prototype.setDocument = function(doc) {
this._doc = doc;
var childViews = this.childNodes;
for (var i = 0, ilen = childViews.length; i < ilen; i++) {
childViews[i].setDocument(doc);
}
};
maria.ElementView.prototype.getTemplate = function() {
@@ -2503,7 +2513,7 @@ maria.ElementView.prototype.build = function() {
maria.ElementView.prototype.buildTemplate = function() {
// parseHTML returns a DocumentFragment so take firstChild as the rootEl
this._rootEl = maria.parseHTML(this.getTemplate(), this._doc).firstChild;
this._rootEl = maria.parseHTML(this.getTemplate(), this.getDocument()).firstChild;
};
(function() {
@@ -3052,7 +3062,8 @@ maria.ElementView.subclass = function(namespace, name, options) {
for (var key in uiActions) {
if (Object.prototype.hasOwnProperty.call(uiActions, key)) {
var methodName = uiActions[key];
if (!Object.prototype.hasOwnProperty.call(properties, methodName)) {
if ((!Object.prototype.hasOwnProperty.call(properties, methodName)) &&
(!(methodName in this.prototype))) {
(function(methodName) {
properties[methodName] = function(evt) {
this.getController()[methodName](evt);
@@ -16,7 +16,6 @@
</script>
<script src="../lib/maria/maria.js"></script>
<script src="../lib/aristocrat/aristocrat.js"></script>
<script src="js/namespace.js"></script>
@@ -7,11 +7,10 @@ maria.ElementView.subclass(checkit, 'TodosAppView', {
return this.find('.content'); // child views will be appended to this element
},
initialize: function() {
var model = this.getModel();
this.appendChild(new checkit.TodosInputView(model));
this.appendChild(new checkit.TodosToolbarView(model));
this.appendChild(new checkit.TodosListView(model));
this.appendChild(new checkit.TodosStatsView(model));
this.appendChild(new checkit.TodosInputView());
this.appendChild(new checkit.TodosToolbarView());
this.appendChild(new checkit.TodosListView());
this.appendChild(new checkit.TodosStatsView());
},
insertBefore: function(newChild, oldChild) {
newChild.setModel(this.getModel());

0 comments on commit 9448fd8

Please sign in to comment.