diff options
author | Valerio Virgillito | 2012-04-23 13:41:16 -0700 |
---|---|---|
committer | Valerio Virgillito | 2012-04-23 13:41:16 -0700 |
commit | d0af21d80441cb7ffe3a92ed00f8dc9b90867098 (patch) | |
tree | 9d40ce988131c4c15340e57c6b542785ccd15dae /js | |
parent | 3dfd75a1d7948ef369188e1ca23c0f044c0d17a1 (diff) | |
download | ninja-d0af21d80441cb7ffe3a92ed00f8dc9b90867098.tar.gz |
adjusting the bread crumb to work with the new template
Initial container get setup in ninja now.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js')
-rwxr-xr-x | js/components/layout/bread-crumb.reel/bread-crumb.js | 25 | ||||
-rwxr-xr-x | js/document/document-html.js | 8 | ||||
-rwxr-xr-x | js/document/html-document.js | 2 | ||||
-rw-r--r-- | js/document/templates/montage-web/main.reel/main.js | 3 | ||||
-rwxr-xr-x | js/ninja.reel/ninja.js | 7 | ||||
-rwxr-xr-x | js/stage/stage.reel/stage.js | 4 |
6 files changed, 35 insertions, 14 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js index f35972b6..597577f1 100755 --- a/js/components/layout/bread-crumb.reel/bread-crumb.js +++ b/js/components/layout/bread-crumb.reel/bread-crumb.js | |||
@@ -63,16 +63,27 @@ exports.Breadcrumb = Montage.create(Component, { | |||
63 | 63 | ||
64 | parentNode = this.container; | 64 | parentNode = this.container; |
65 | 65 | ||
66 | while(parentNode.id !== "UserContent") { | 66 | // This is for the old template support. |
67 | // TODO: Remove marker for old template: NINJA-STAGE-REWORK | ||
68 | if(this.application.ninja.currentDocument.documentRoot.id === "UserContent") { | ||
69 | while(parentNode.id !== "UserContent") { | ||
70 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); | ||
71 | parentNode = parentNode.parentNode; | ||
72 | } | ||
73 | |||
74 | // This is always the top container which is now hardcoded to body | ||
75 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": "Body"}); | ||
76 | } else { | ||
77 | while(parentNode !== this.application.ninja.currentDocument.documentRoot) { | ||
78 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); | ||
79 | parentNode = parentNode.parentNode; | ||
80 | } | ||
81 | |||
82 | // This is always the top container which is now hardcoded to body | ||
67 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); | 83 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); |
68 | parentNode = parentNode.parentNode; | 84 | console.log("this works!"); |
69 | } | 85 | } |
70 | 86 | ||
71 | // This is always the top container which is now hardcoded to body | ||
72 | this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": "Body"}); | ||
73 | |||
74 | |||
75 | |||
76 | } | 87 | } |
77 | }, | 88 | }, |
78 | 89 | ||
diff --git a/js/document/document-html.js b/js/document/document-html.js index 841e66ed..8cb88516 100755 --- a/js/document/document-html.js +++ b/js/document/document-html.js | |||
@@ -67,8 +67,8 @@ exports.HtmlDocument = Montage.create(Component, { | |||
67 | 67 | ||
68 | // this.init(file.name, file.uri, file.extension, iframe, uuid, callback); | 68 | // this.init(file.name, file.uri, file.extension, iframe, uuid, callback); |
69 | 69 | ||
70 | |||
70 | this.iframe = this.createView(); | 71 | this.iframe = this.createView(); |
71 | this.iframe.addEventListener("load", this.handleWebTemplateLoad.bind(this), true); | ||
72 | 72 | ||
73 | //this.selectionExclude = ["HTML", "BODY", "Viewport", "UserContent", "stageBG"]; | 73 | //this.selectionExclude = ["HTML", "BODY", "Viewport", "UserContent", "stageBG"]; |
74 | //this.currentView = "design"; | 74 | //this.currentView = "design"; |
@@ -96,6 +96,7 @@ exports.HtmlDocument = Montage.create(Component, { | |||
96 | // ifr.style.opacity = 0; | 96 | // ifr.style.opacity = 0; |
97 | 97 | ||
98 | ifr.src = "js/document/templates/montage-web/index.html"; | 98 | ifr.src = "js/document/templates/montage-web/index.html"; |
99 | ifr.addEventListener("load", this.handleWebTemplateLoad.bind(this), true); | ||
99 | 100 | ||
100 | return document.getElementById("iframeContainer").appendChild(ifr); | 101 | return document.getElementById("iframeContainer").appendChild(ifr); |
101 | } | 102 | } |
@@ -124,8 +125,7 @@ exports.HtmlDocument = Montage.create(Component, { | |||
124 | 125 | ||
125 | // TODO: We don't need this anymore -> need to setup the main container still | 126 | // TODO: We don't need this anymore -> need to setup the main container still |
126 | //Adding a handler for the main user document reel to finish loading | 127 | //Adding a handler for the main user document reel to finish loading |
127 | //this._document.body.addEventListener("userTemplateDidLoad", this.userTemplateDidLoad.bind(this), false); | 128 | // this.documentRoot.addEventListener("userTemplateDidLoad", this.userTemplateDidLoad.bind(this), false); |
128 | this.documentRoot.addEventListener("userTemplateDidLoad", this.userTemplateDidLoad.bind(this), false); | ||
129 | 129 | ||
130 | // Live node list of the current loaded document | 130 | // Live node list of the current loaded document |
131 | this._liveNodeList = this.documentRoot.getElementsByTagName('*'); | 131 | this._liveNodeList = this.documentRoot.getElementsByTagName('*'); |
@@ -314,7 +314,7 @@ exports.HtmlDocument = Montage.create(Component, { | |||
314 | // Setting up the currentSelectedContainer to the document body. | 314 | // Setting up the currentSelectedContainer to the document body. |
315 | userTemplateDidLoad: { | 315 | userTemplateDidLoad: { |
316 | value: function(){ | 316 | value: function(){ |
317 | this.application.ninja.currentSelectedContainer = this.documentRoot; | 317 | // this.application.ninja.currentSelectedContainer = this.documentRoot; |
318 | } | 318 | } |
319 | } | 319 | } |
320 | }); | 320 | }); |
diff --git a/js/document/html-document.js b/js/document/html-document.js index 9873fdd1..54db9eaa 100755 --- a/js/document/html-document.js +++ b/js/document/html-document.js | |||
@@ -826,7 +826,7 @@ exports.HTMLDocument = Montage.create(TextDocument, { | |||
826 | // Setting up the currentSelectedContainer to the document body. | 826 | // Setting up the currentSelectedContainer to the document body. |
827 | userTemplateDidLoad: { | 827 | userTemplateDidLoad: { |
828 | value: function(){ | 828 | value: function(){ |
829 | this.application.ninja.currentSelectedContainer = this.documentRoot; | 829 | //this.application.ninja.currentSelectedContainer = this.documentRoot; |
830 | } | 830 | } |
831 | }, | 831 | }, |
832 | 832 | ||
diff --git a/js/document/templates/montage-web/main.reel/main.js b/js/document/templates/montage-web/main.reel/main.js index 019c675e..d5ac88d5 100644 --- a/js/document/templates/montage-web/main.reel/main.js +++ b/js/document/templates/montage-web/main.reel/main.js | |||
@@ -38,10 +38,11 @@ exports.Main = Montage.create(Component, { | |||
38 | }; | 38 | }; |
39 | 39 | ||
40 | // Dispatch event when this template has loaded. | 40 | // Dispatch event when this template has loaded. |
41 | /* | ||
41 | var newEvent = document.createEvent( "CustomEvent" ); | 42 | var newEvent = document.createEvent( "CustomEvent" ); |
42 | newEvent.initCustomEvent( "userTemplateDidLoad", false, true ); | 43 | newEvent.initCustomEvent( "userTemplateDidLoad", false, true ); |
43 | |||
44 | document.body.dispatchEvent( newEvent ); | 44 | document.body.dispatchEvent( newEvent ); |
45 | */ | ||
45 | 46 | ||
46 | } | 47 | } |
47 | } | 48 | } |
diff --git a/js/ninja.reel/ninja.js b/js/ninja.reel/ninja.js index 2fedd71d..d2d45410 100755 --- a/js/ninja.reel/ninja.js +++ b/js/ninja.reel/ninja.js | |||
@@ -269,6 +269,13 @@ exports.Ninja = Montage.create(Component, { | |||
269 | value: function(event) { | 269 | value: function(event) { |
270 | this.currentDocument = event.detail; | 270 | this.currentDocument = event.detail; |
271 | 271 | ||
272 | if(this.currentDocument.documentRoot) { | ||
273 | this.application.ninja.currentSelectedContainer = this.currentDocument.documentRoot; | ||
274 | } else { | ||
275 | alert("The current document has not loaded yet"); | ||
276 | return; | ||
277 | } | ||
278 | |||
272 | this.appModel.show3dGrid = this.currentDocument.draw3DGrid; | 279 | this.appModel.show3dGrid = this.currentDocument.draw3DGrid; |
273 | NJevent("openDocument"); | 280 | NJevent("openDocument"); |
274 | } | 281 | } |
diff --git a/js/stage/stage.reel/stage.js b/js/stage/stage.reel/stage.js index ec8c0e55..8382135d 100755 --- a/js/stage/stage.reel/stage.js +++ b/js/stage/stage.reel/stage.js | |||
@@ -252,7 +252,9 @@ exports.Stage = Montage.create(Component, { | |||
252 | this.application.ninja.currentDocument.savedLeftScroll = this._iframeContainer.scrollLeft; | 252 | this.application.ninja.currentDocument.savedLeftScroll = this._iframeContainer.scrollLeft; |
253 | this.application.ninja.currentDocument.savedTopScroll = this._iframeContainer.scrollTop; | 253 | this.application.ninja.currentDocument.savedTopScroll = this._iframeContainer.scrollTop; |
254 | 254 | ||
255 | this.userContentBorder = parseInt(this._documentRoot.elementModel.controller.getProperty(this._documentRoot, "border")); | 255 | // Hardcode this value so that it does not fail for the new stage architecture |
256 | // TODO: Remove marker for old template: NINJA-STAGE-REWORK | ||
257 | this.userContentBorder = 1; //parseInt(this._documentRoot.elementModel.controller.getProperty(this._documentRoot, "border")); | ||
256 | 258 | ||
257 | this._userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder; | 259 | this._userContentLeft = this._documentOffsetLeft - this._scrollLeft + this._userContentBorder; |
258 | this._userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder; | 260 | this._userContentTop = this._documentOffsetTop - this._scrollTop + this._userContentBorder; |