projects
/
app.Builder.js
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
resources/roo.builder.js
[app.Builder.js]
/
resources
/
roo.builder.js
diff --git
a/resources/roo.builder.js
b/resources/roo.builder.js
index
7dca16c
..
2163657
100644
(file)
--- a/
resources/roo.builder.js
+++ b/
resources/roo.builder.js
@@
-4,8
+4,6
@@
// IPC: - via alert("IPC:{method}:{data}
// IPC: - via alert("IPC:{method}:{data}
-Roo.XComponent.on("buildcomplete", function() { Builder.saveHTML(); } );
-
var MODULE = { isBuilder : true };
// BC
var _this = MODULE;
var MODULE = { isBuilder : true };
// BC
var _this = MODULE;
@@
-37,12
+35,12
@@
Builder = {
traverseDOMTree : function(cb, currentElement, depth) {
traverseDOMTree : function(cb, currentElement, depth) {
- if (!currentElement) {
+ if (!currentElement
) {
return;
}
return;
}
- console.log(currentElement);
- if (currentElement.className.match(/roo-dynamic/)) {
+
//
console.log(currentElement);
+ if (currentElement.className
&& currentElement.className
.match(/roo-dynamic/)) {
return;
}
return;
}
@@
-56,6
+54,9
@@
Builder = {
return;
}
return;
}
+ if (nodeName.match(/^#/)) { // comments?
+ return;
+ }
@@
-64,8
+65,13
@@
Builder = {
return;
}
if (nodeName != 'BODY') {
return;
}
if (nodeName != 'BODY') {
-
-
+ //Roo.log(currentElement);
+ if (currentElement.hasAttribute('flexy:include')) {
+
+
+ cb( '<flexy:include src="'+currentElement.getAttribute('flexy:include')+'"></flexy:include>');
+ return;
+ }
var i = 0;
// Prints the node tagName, such as <A>, <IMG>, etc
var i = 0;
// Prints the node tagName, such as <A>, <IMG>, etc
@@
-92,6
+98,8
@@
Builder = {
} else {
tagName = false;
}
} else {
tagName = false;
}
+
+
// Traverse the tree
i = 0;
var currentElementChild = currentElement.childNodes.item(i);
// Traverse the tree
i = 0;
var currentElementChild = currentElement.childNodes.item(i);
@@
-276,7
+284,7
@@
Builder = {
}
id = ''+ id;
var bid = id.length ? 'builder-' + id : '';
}
id = ''+ id;
var bid = id.length ? 'builder-' + id : '';
- console.log('{ "hover-node" : "' + bid + '"}');
+
//
console.log('{ "hover-node" : "' + bid + '"}');
this.lastID = id;
},
clearBootstrap : function()
this.lastID = id;
},
clearBootstrap : function()
@@
-306,6
+314,9
@@
Builder = {
applyFlexy: function(tree)
{
applyFlexy: function(tree)
{
+ if (!tree.el) {
+ return;
+ }
if (typeof(tree['flexy:foreach']) != 'undefined') {
//Roo.log("add flexy:foreach");
tree.el.attr('flexy:foreach', tree['flexy:foreach']);
if (typeof(tree['flexy:foreach']) != 'undefined') {
//Roo.log("add flexy:foreach");
tree.el.attr('flexy:foreach', tree['flexy:foreach']);
@@
-324,11
+335,27
@@
Builder = {
tree.el.attr('flexy:include', tree['flexy:include']);
}
tree.el.attr('flexy:include', tree['flexy:include']);
}
- if (!tree.items || !tree.items.length) { return; }
+ if (typeof(tree['flexy:ignore']) != 'undefined') {
+ //Roo.log("add flexy:if");
+ tree.el.attr('flexy:ignore', tree['flexy:ignore']);
+ }
+
+ tree.el.attr('xtype', tree['|xns'] + '.' + tree['xtype']);
+ Roo.log(tree);
+ //Roo.log("Add xtype")
- for (var i = 0; i < tree.items.length; i++){
- this.applyFlexy(tree.items[i]);
+
+
+ if (tree.items && tree.items.length > 0) {
+ //Roo.log(tree);
+ for (var i = 0; i < tree.items.length; i++){
+ this.applyFlexy(tree.items[i]);
+ }
}
}
+ if (typeof(tree.menu) == 'object') {
+ this.applyFlexy(tree.menu);
+ }
+
}
}
@@
-337,6
+364,8
@@
Builder = {
Roo.onReady(function() { Builder.clearBootstrap(); });
Roo.XComponent.on('buildcomplete', function() {
Roo.log("xcomponent built!");
Roo.onReady(function() { Builder.clearBootstrap(); });
Roo.XComponent.on('buildcomplete', function() {
Roo.log("xcomponent built!");
+ var m = Roo.XComponent.modules;
+ Builder.applyFlexy(m[m.length-1].el);
-
Builder.applyFlexy(Roo.XComponent.modules[0].el
);
+
Builder.saveHTML.defer(100, Builder
);
});
\ No newline at end of file
});
\ No newline at end of file