3.0 source code

This commit is contained in:
agolybev
2015-04-28 17:59:00 +03:00
parent c69fd34bdd
commit 7b3b2248e5
16311 changed files with 1445974 additions and 3108429 deletions

View File

@@ -0,0 +1,54 @@
/**
*
*/
Ext.define('Ext.mixin.Templatable', {
extend: 'Ext.mixin.Mixin',
mixinConfig: {
id: 'templatable'
},
referenceAttributeName: 'reference',
referenceSelector: '[reference]',
getElementConfig: function() {
return {
reference: 'element'
};
},
getElementTemplate: function() {
var elementTemplate = document.createDocumentFragment();
elementTemplate.appendChild(Ext.Element.create(this.getElementConfig(), true));
return elementTemplate;
},
initElement: function() {
var prototype = this.self.prototype;
prototype.elementTemplate = this.getElementTemplate();
prototype.initElement = prototype.doInitElement;
this.initElement.apply(this, arguments);
},
linkElement: function(reference, node) {
this.link(reference, node);
},
doInitElement: function() {
var referenceAttributeName = this.referenceAttributeName,
renderElement, referenceNodes, i, ln, referenceNode, reference;
renderElement = this.elementTemplate.cloneNode(true);
referenceNodes = renderElement.querySelectorAll(this.referenceSelector);
for (i = 0,ln = referenceNodes.length; i < ln; i++) {
referenceNode = referenceNodes[i];
reference = referenceNode.getAttribute(referenceAttributeName);
referenceNode.removeAttribute(referenceAttributeName);
this.linkElement(reference, referenceNode);
}
}
});