aboutsummaryrefslogtreecommitdiff
path: root/js/document
diff options
context:
space:
mode:
Diffstat (limited to 'js/document')
-rwxr-xr-xjs/document/document-html.js3
-rwxr-xr-xjs/document/models/base.js13
-rwxr-xr-xjs/document/models/html.js3
-rw-r--r--js/document/templates/app/main.js4
-rwxr-xr-xjs/document/templates/html/index.html5
-rwxr-xr-xjs/document/views/design.js7
6 files changed, 28 insertions, 7 deletions
diff --git a/js/document/document-html.js b/js/document/document-html.js
index b9c8e797..56f4e3d3 100755
--- a/js/document/document-html.js
+++ b/js/document/document-html.js
@@ -106,7 +106,8 @@ exports.HtmlDocument = Montage.create(Component, {
106 } 106 }
107 }, 107 },
108 handleViewReady: { 108 handleViewReady: {
109 value: function() { 109 value: function(mObjects) {
110 this.model.mObjects = mObjects;
110 // TODO: Find a better way to initialize this property 111 // TODO: Find a better way to initialize this property
111 // Assign the domContainer to be the document root on open 112 // Assign the domContainer to be the document root on open
112 if(typeof this.model.domContainer !== "undefined") { 113 if(typeof this.model.domContainer !== "undefined") {
diff --git a/js/document/models/base.js b/js/document/models/base.js
index 8ff52132..1daec5c0 100755
--- a/js/document/models/base.js
+++ b/js/document/models/base.js
@@ -95,6 +95,19 @@ exports.BaseDocumentModel = Montage.create(Component, {
95 libs: { 95 libs: {
96 value: null 96 value: null
97 }, 97 },
98
99 _mObjects: {
100 value: []
101 },
102
103 mObjects: {
104 get: function() {
105 return this._mObjects;
106 },
107 set: function(value) {
108 this._mObjects = value;
109 }
110 },
98 //////////////////////////////////////////////////////////////////// 111 ////////////////////////////////////////////////////////////////////
99 // 112 //
100 switchViewTo: { 113 switchViewTo: {
diff --git a/js/document/models/html.js b/js/document/models/html.js
index 4a232ee1..d9002b4e 100755
--- a/js/document/models/html.js
+++ b/js/document/models/html.js
@@ -68,9 +68,10 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, {
68 // 68 //
69 webGlHelper: { 69 webGlHelper: {
70 value: null 70 value: null
71 }, 71 }
72 //////////////////////////////////////////////////////////////////// 72 ////////////////////////////////////////////////////////////////////
73 //////////////////////////////////////////////////////////////////// 73 ////////////////////////////////////////////////////////////////////
74
74}); 75});
75//////////////////////////////////////////////////////////////////////// 76////////////////////////////////////////////////////////////////////////
76//////////////////////////////////////////////////////////////////////// \ No newline at end of file 77//////////////////////////////////////////////////////////////////////// \ No newline at end of file
diff --git a/js/document/templates/app/main.js b/js/document/templates/app/main.js
index 8dc05ba5..7737ae4c 100644
--- a/js/document/templates/app/main.js
+++ b/js/document/templates/app/main.js
@@ -61,7 +61,7 @@ exports.Main = Montage.create(Component, {
61 var componentRequire = component[data.name]; 61 var componentRequire = component[data.name];
62 var componentInstance = componentRequire.create(); 62 var componentInstance = componentRequire.create();
63 63
64 64 componentInstance._montage_metadata.label = componentInstance.identifier = data.name;
65 componentInstance.addEventListener("firstDraw", self, false); 65 componentInstance.addEventListener("firstDraw", self, false);
66 66
67 componentInstance.element = element; 67 componentInstance.element = element;
@@ -69,8 +69,6 @@ exports.Main = Montage.create(Component, {
69 componentInstance.ownerComponent = self; 69 componentInstance.ownerComponent = self;
70 70
71 self.componentToInsert = componentInstance; 71 self.componentToInsert = componentInstance;
72
73
74 callback(componentInstance, element); 72 callback(componentInstance, element);
75 }) 73 })
76 .end(); 74 .end();
diff --git a/js/document/templates/html/index.html b/js/document/templates/html/index.html
index 8fc0d82f..bee2e557 100755
--- a/js/document/templates/html/index.html
+++ b/js/document/templates/html/index.html
@@ -113,7 +113,10 @@
113 <script type="text/montage-serialization" data-ninja-template="true"> 113 <script type="text/montage-serialization" data-ninja-template="true">
114 { 114 {
115 "owner": { 115 "owner": {
116 "prototype": "main" 116 "prototype": "main",
117 "properties": {
118 "identifier": "testOwner"
119 }
117 } 120 }
118 } 121 }
119 </script> 122 </script>
diff --git a/js/document/views/design.js b/js/document/views/design.js
index 44c61617..6a6f565d 100755
--- a/js/document/views/design.js
+++ b/js/document/views/design.js
@@ -455,20 +455,25 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, {
455 value: function (scripttags) { 455 value: function (scripttags) {
456 var self = this; 456 var self = this;
457 // 457 //
458 //debugger;
458 this.iframe.contentWindow.document.body.addEventListener('mjsTemplateReady', function () { 459 this.iframe.contentWindow.document.body.addEventListener('mjsTemplateReady', function () {
459 //Initializing template with user's seriliazation 460 //Initializing template with user's seriliazation
460 var template = this.iframe.contentWindow.mjsTemplate.create(); 461 var template = this.iframe.contentWindow.mjsTemplate.create();
462
461 template.initWithDocument(this.iframe.contentWindow.document); 463 template.initWithDocument(this.iframe.contentWindow.document);
462 template.instantiateWithOwnerAndDocument(null, this.iframe.contentWindow.document, function (){ 464 template.instantiateWithOwnerAndDocument(null, this.iframe.contentWindow.document, function (){
463 //TODO: Verify this is properly done, seems like a hack 465 //TODO: Verify this is properly done, seems like a hack
466
467 var objArray = [];
464 for (var c in template._deserializer._objects) { 468 for (var c in template._deserializer._objects) {
465 //Forcing draw on components 469 //Forcing draw on components
466 template._deserializer._objects[c].needsDraw = true; 470 template._deserializer._objects[c].needsDraw = true;
471 objArray.push(template._deserializer._objects[c]);
467 } 472 }
468 473
469 // Now call the view callback 474 // Now call the view callback
470 if(self._viewCallback) { 475 if(self._viewCallback) {
471 self._viewCallback.viewCallback.call(self._viewCallback.context); 476 self._viewCallback.viewCallback.call(self._viewCallback.context, objArray);
472 } 477 }
473 478
474 }); 479 });