diff options
author | Eric Guzman | 2012-05-25 16:37:24 -0700 |
---|---|---|
committer | Eric Guzman | 2012-05-25 16:37:24 -0700 |
commit | 1f7c17d688c3340b31d2e1c2b7205b10bd806968 (patch) | |
tree | c37508ed332fea9121948c887e7f844f327b2ff3 /js/document | |
parent | 1be5495b77c1dd426be3a6be05555254856de6ba (diff) | |
download | ninja-1f7c17d688c3340b31d2e1c2b7205b10bd806968.tar.gz |
Objects Controller - Now keeps track of document's object instances, including added components
Diffstat (limited to 'js/document')
-rwxr-xr-x | js/document/models/html.js | 5 | ||||
-rw-r--r-- | js/document/templates/app/main.js | 1 | ||||
-rwxr-xr-x | js/document/views/design.js | 6 |
3 files changed, 11 insertions, 1 deletions
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, { | |||
69 | setComponentInstance: { | 69 | setComponentInstance: { |
70 | value: function(instance, el) { | 70 | value: function(instance, el) { |
71 | this.userComponents[el.uuid] = instance; | 71 | this.userComponents[el.uuid] = instance; |
72 | this.objects.push(instance); | ||
72 | } | 73 | } |
73 | }, | 74 | }, |
74 | //////////////////////////////////////////////////////////////////// | 75 | //////////////////////////////////////////////////////////////////// |
@@ -81,6 +82,10 @@ exports.HtmlDocumentModel = Montage.create(BaseDocumentModel, { | |||
81 | return null; | 82 | return null; |
82 | } | 83 | } |
83 | } | 84 | } |
85 | }, | ||
86 | //////////////////////////////////////////////////////////////////// | ||
87 | objects : { | ||
88 | value: null | ||
84 | } | 89 | } |
85 | //////////////////////////////////////////////////////////////////// | 90 | //////////////////////////////////////////////////////////////////// |
86 | //////////////////////////////////////////////////////////////////// | 91 | //////////////////////////////////////////////////////////////////// |
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, { | |||
29 | var componentRequire = component[data.name]; | 29 | var componentRequire = component[data.name]; |
30 | var componentInstance = componentRequire.create(); | 30 | var componentInstance = componentRequire.create(); |
31 | 31 | ||
32 | componentInstance._montage_metadata.label = data.name; | ||
32 | componentInstance.element = element; | 33 | componentInstance.element = element; |
33 | 34 | ||
34 | componentInstance.needsDraw = true; | 35 | 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, { | |||
363 | initMontage: { | 363 | initMontage: { |
364 | value: function (scripttags) { | 364 | value: function (scripttags) { |
365 | // | 365 | // |
366 | //debugger; | ||
366 | this.iframe.contentWindow.document.body.addEventListener('mjsTemplateReady', function () { | 367 | this.iframe.contentWindow.document.body.addEventListener('mjsTemplateReady', function () { |
367 | //Initializing template with user's seriliazation | 368 | //Initializing template with user's seriliazation |
368 | var template = this.iframe.contentWindow.mjsTemplate.create(); | 369 | var template = this.iframe.contentWindow.mjsTemplate.create(); |
370 | |||
369 | template.initWithDocument(this.iframe.contentWindow.document); | 371 | template.initWithDocument(this.iframe.contentWindow.document); |
370 | template.instantiateWithOwnerAndDocument(null, this.iframe.contentWindow.document, function (e){/*Nothing just a required extra parameter*/}); | 372 | template.instantiateWithOwnerAndDocument(null, this.iframe.contentWindow.document, function (e){ |
373 | this.model.objects = template.deserializer.getObjectsFromLastDeserialization(); | ||
374 | }.bind(this)); | ||
371 | }.bind(this), false); | 375 | }.bind(this), false); |
372 | } | 376 | } |
373 | }, | 377 | }, |