From 95bef3bbd77c6c3bd01b5222986f2dd35a7218b4 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Sat, 19 May 2012 14:48:35 -0700 Subject: Changes to binding view Signed-off-by: Armen Kesablyan --- js/document/templates/html/index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'js/document') diff --git a/js/document/templates/html/index.html b/js/document/templates/html/index.html index 933df157..1bd3da1b 100755 --- a/js/document/templates/html/index.html +++ b/js/document/templates/html/index.html @@ -67,7 +67,10 @@ -- cgit v1.2.3 From 1f7c17d688c3340b31d2e1c2b7205b10bd806968 Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Fri, 25 May 2012 16:37:24 -0700 Subject: Objects Controller - Now keeps track of document's object instances, including added components --- js/document/models/html.js | 5 +++++ js/document/templates/app/main.js | 1 + js/document/views/design.js | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) (limited to 'js/document') diff --git a/js/document/models/html.js b/js/document/models/html.js index 9cc8ce92..10112565 100755 --- a/js/document/models/html.js +++ b/js/document/models/html.js @@ -69,6 +69,7 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { setComponentInstance: { value: function(instance, el) { this.userComponents[el.uuid] = instance; + this.objects.push(instance); } }, //////////////////////////////////////////////////////////////////// @@ -81,6 +82,10 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { return null; } } + }, + //////////////////////////////////////////////////////////////////// + objects : { + value: null } //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// diff --git a/js/document/templates/app/main.js b/js/document/templates/app/main.js index a406abdb..91c46fda 100644 --- a/js/document/templates/app/main.js +++ b/js/document/templates/app/main.js @@ -29,6 +29,7 @@ exports.Main = Montage.create(Component, { var componentRequire = component[data.name]; var componentInstance = componentRequire.create(); + componentInstance._montage_metadata.label = data.name; componentInstance.element = element; componentInstance.needsDraw = true; diff --git a/js/document/views/design.js b/js/document/views/design.js index b3887fdf..75eb3695 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -363,11 +363,15 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { initMontage: { value: function (scripttags) { // + //debugger; this.iframe.contentWindow.document.body.addEventListener('mjsTemplateReady', function () { //Initializing template with user's seriliazation var template = this.iframe.contentWindow.mjsTemplate.create(); + template.initWithDocument(this.iframe.contentWindow.document); - template.instantiateWithOwnerAndDocument(null, this.iframe.contentWindow.document, function (e){/*Nothing just a required extra parameter*/}); + template.instantiateWithOwnerAndDocument(null, this.iframe.contentWindow.document, function (e){ + this.model.objects = template.deserializer.getObjectsFromLastDeserialization(); + }.bind(this)); }.bind(this), false); } }, -- cgit v1.2.3 From 47d45e16bee15fd9f1f793a0bad3b93ad1b985fc Mon Sep 17 00:00:00 2001 From: Eric Guzman Date: Mon, 11 Jun 2012 07:19:19 -0700 Subject: Edit View - Add buttons and calls controller (saves bindings) --- js/document/templates/app/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/document') diff --git a/js/document/templates/app/main.js b/js/document/templates/app/main.js index 91c46fda..e2bdc1a0 100644 --- a/js/document/templates/app/main.js +++ b/js/document/templates/app/main.js @@ -29,7 +29,7 @@ exports.Main = Montage.create(Component, { var componentRequire = component[data.name]; var componentInstance = componentRequire.create(); - componentInstance._montage_metadata.label = data.name; + componentInstance._montage_metadata.label = componentInstance.identifier = data.name; componentInstance.element = element; componentInstance.needsDraw = true; -- cgit v1.2.3 From 337efc667372326ae2f9984d89a47bb151016774 Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Mon, 11 Jun 2012 13:25:13 -0700 Subject: Changes Made to Object Listing of iFrame Signed-off-by: Armen Kesablyan --- js/document/document-html.js | 3 ++- js/document/models/base.js | 13 +++++++++++++ js/document/models/html.js | 3 ++- js/document/views/design.js | 6 ++++-- 4 files changed, 21 insertions(+), 4 deletions(-) (limited to 'js/document') diff --git a/js/document/document-html.js b/js/document/document-html.js index 04565753..8b82c40f 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js @@ -106,7 +106,8 @@ exports.HtmlDocument = Montage.create(Component, { } }, handleViewReady: { - value: function() { + value: function(mObjects) { + this.model.mObjects = mObjects; //Making callback after view is loaded this.loaded.callback.call(this.loaded.context, this); } diff --git a/js/document/models/base.js b/js/document/models/base.js index 5fa06259..9c26bd2a 100755 --- a/js/document/models/base.js +++ b/js/document/models/base.js @@ -91,6 +91,19 @@ exports.BaseDocumentModel = Montage.create(Component, { libs: { value: null }, + + _mObjects: { + value: [] + }, + + mObjects: { + get: function() { + return this._mObjects; + }, + set: function(value) { + this._mObjects = value; + } + }, //////////////////////////////////////////////////////////////////// // switchViewTo: { diff --git a/js/document/models/html.js b/js/document/models/html.js index 7064c6e3..f65cd8c3 100755 --- a/js/document/models/html.js +++ b/js/document/models/html.js @@ -73,9 +73,10 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { // webGlHelper: { value: null - }, + } //////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////// + }); //////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////// \ No newline at end of file diff --git a/js/document/views/design.js b/js/document/views/design.js index dad6de8b..4484167a 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -450,15 +450,17 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { template.initWithDocument(this.iframe.contentWindow.document); template.instantiateWithOwnerAndDocument(null, this.iframe.contentWindow.document, function (){ //TODO: Verify this is properly done, seems like a hack + + var objArray = []; for (var c in template._deserializer._objects) { //Forcing draw on components template._deserializer._objects[c].needsDraw = true; - //this.model.objects = template.deserializer.getObjectsFromLastDeserialization(); + objArray.push(template._deserializer._objects[c]); } // Now call the view callback if(self._viewCallback) { - self._viewCallback.viewCallback.call(self._viewCallback.context); + self._viewCallback.viewCallback.call(self._viewCallback.context, objArray); } }); -- cgit v1.2.3 From 4565558afff6fb07db3b5165042e028f467ac41b Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Thu, 21 Jun 2012 15:46:26 -0700 Subject: Binding View :Requested Changes for Pull Request Signed-off-by: Armen Kesablyan --- js/document/templates/html/index.html | 5 +---- js/document/views/design.js | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) (limited to 'js/document') diff --git a/js/document/templates/html/index.html b/js/document/templates/html/index.html index bee2e557..8fc0d82f 100755 --- a/js/document/templates/html/index.html +++ b/js/document/templates/html/index.html @@ -113,10 +113,7 @@ diff --git a/js/document/views/design.js b/js/document/views/design.js index 6a6f565d..4a75a1b4 100755 --- a/js/document/views/design.js +++ b/js/document/views/design.js @@ -454,8 +454,7 @@ exports.DesignDocumentView = Montage.create(BaseDocumentView, { initMontage: { value: function (scripttags) { var self = this; - // - //debugger; + this.iframe.contentWindow.document.body.addEventListener('mjsTemplateReady', function () { //Initializing template with user's seriliazation var template = this.iframe.contentWindow.mjsTemplate.create(); -- cgit v1.2.3 From b73e0aa2cffa3ffd2b574645f6ec88dc34726caa Mon Sep 17 00:00:00 2001 From: Armen Kesablyan Date: Mon, 25 Jun 2012 14:05:38 -0700 Subject: Can bind Multiple instance Signed-off-by: Armen Kesablyan --- js/document/templates/app/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'js/document') diff --git a/js/document/templates/app/main.js b/js/document/templates/app/main.js index 7737ae4c..0da1b87e 100644 --- a/js/document/templates/app/main.js +++ b/js/document/templates/app/main.js @@ -61,7 +61,7 @@ exports.Main = Montage.create(Component, { var componentRequire = component[data.name]; var componentInstance = componentRequire.create(); - componentInstance._montage_metadata.label = componentInstance.identifier = data.name; + componentInstance.identifier = data.identifier; componentInstance.addEventListener("firstDraw", self, false); componentInstance.element = element; -- cgit v1.2.3