Skip to content

Commit

Permalink
Initialize template model config when stamping.
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinpschaaf committed Feb 21, 2015
1 parent a7552fc commit d31279c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 13 deletions.
4 changes: 2 additions & 2 deletions src/features/standard/configure.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
Base.addFeature({

// storage for configuration
_setupConfigure: function() {
this._config = {};
_setupConfigure: function(initialConfig) {
this._config = initialConfig || {};
this._handlers = [];
},

Expand Down
16 changes: 5 additions & 11 deletions src/lib/template/templatizer.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
archetype._notifyPath = this._notifyPathImpl;
// boilerplate code
var _constructor = this._constructorImpl;
var ctor = function() {
_constructor.call(this);
var ctor = function TemplateInstance(model) {
_constructor.call(this, model);
};
// standard references
ctor.prototype = archetype;
Expand Down Expand Up @@ -88,8 +88,8 @@
}
},

_constructorImpl: function() {
this._setupConfigure();
_constructorImpl: function(model) {
this._setupConfigure(model);
this.root = this.instanceTemplate(this._template);
this._marshalTemplateContent();
this._marshalAnnotatedNodes();
Expand All @@ -99,13 +99,7 @@
},

stamp: function(model) {
var instance = new this.ctor();
if (model) {
for (var n in model) {
instance[n] = model[n];
}
}
return instance;
return new this.ctor(model);
}

};
Expand Down

0 comments on commit d31279c

Please sign in to comment.