aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-24 11:59:17 -0700
committerValerio Virgillito2012-05-24 11:59:17 -0700
commit70ff8dd670bc37c14caf850e06791d1e293b1e4b (patch)
tree8e00a27c6c908dda3e816d1f5aaf0d2a889ca5dc
parenta8eb5c65a21af3bf8d8b8eb3e65b494b8bd9bc01 (diff)
parenta6db492176a85546047dae6d5ecb9cfc4325e043 (diff)
downloadninja-70ff8dd670bc37c14caf850e06791d1e293b1e4b.tar.gz
Merge pull request #255 from joseeight/Document
Cleaning up referencing to documentRoot
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.js4
-rwxr-xr-xjs/controllers/document-controller.js82
-rwxr-xr-xjs/controllers/selection-controller.js6
-rwxr-xr-xjs/controllers/styles-controller.js36
-rwxr-xr-xjs/document/_toDelete/html-document.js (renamed from js/document/html-document.js)0
-rwxr-xr-xjs/document/_toDelete/text-document.js (renamed from js/document/text-document.js)0
-rwxr-xr-xjs/document/document-html.js34
-rwxr-xr-xjs/document/models/html.js5
-rwxr-xr-xjs/document/views/base.js2
-rwxr-xr-xjs/document/views/design.js15
-rwxr-xr-xjs/helper-classes/3D/draw-utils.js12
-rwxr-xr-xjs/helper-classes/3D/snap-manager.js6
-rwxr-xr-xjs/helper-classes/3D/view-utils.js44
-rwxr-xr-xjs/lib/NJUtils.js2
-rwxr-xr-xjs/mediators/element-mediator.js4
-rwxr-xr-xjs/ninja.reel/ninja.js14
-rwxr-xr-xjs/panels/CSSPanel/CSSPanelBase.reel/CSSPanelBase.js2
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js6
-rw-r--r--js/panels/Timeline/TimelineTrack.reel/TimelineTrack.js4
-rwxr-xr-xjs/panels/components-panel.reel/components-panel.js4
-rw-r--r--js/panels/css-panel/styles-view-delegate.js2
-rwxr-xr-xjs/panels/properties.reel/properties.js12
-rwxr-xr-xjs/panels/properties.reel/sections/custom.reel/custom.js2
-rwxr-xr-xjs/panels/properties.reel/sections/position-size.reel/position-size.js8
-rwxr-xr-xjs/panels/properties.reel/sections/three-d-view.reel/three-d-view.js2
-rwxr-xr-xjs/stage/layout.js6
-rwxr-xr-xjs/stage/stage.reel/stage.js14
-rwxr-xr-xjs/stage/tool-handle.js4
-rwxr-xr-xjs/tools/PanTool.js16
-rwxr-xr-xjs/tools/Rotate3DToolBase.js12
-rwxr-xr-xjs/tools/RotateStage3DTool.js8
-rwxr-xr-xjs/tools/SelectionTool.js6
-rwxr-xr-xjs/tools/Translate3DToolBase.js4
-rwxr-xr-xjs/tools/ZoomTool.js2
-rwxr-xr-xjs/tools/drawing-tool-base.js12
-rwxr-xr-xjs/tools/modifier-tool-base.js8
36 files changed, 188 insertions, 212 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js
index aaefd923..49dbe3cb 100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.js
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.js
@@ -23,7 +23,7 @@ exports.Breadcrumb = Montage.create(Component, {
23 value: function(){ 23 value: function(){
24 if(!this.application.ninja.documentController.activeDocument && this.application.ninja.currentDocument.currentView !== "code") { 24 if(!this.application.ninja.documentController.activeDocument && this.application.ninja.currentDocument.currentView !== "code") {
25 this.disabled = true; 25 this.disabled = true;
26 this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.documentRoot : null); 26 this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.model.documentRoot : null);
27 } 27 }
28 } 28 }
29 }, 29 },
@@ -65,7 +65,7 @@ exports.Breadcrumb = Montage.create(Component, {
65 65
66 parentNode = this.container; 66 parentNode = this.container;
67 67
68 while(parentNode !== this.application.ninja.currentDocument.documentRoot) { 68 while(parentNode !== this.application.ninja.currentDocument.model.documentRoot) {
69 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); 69 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName});
70 parentNode = parentNode.parentNode; 70 parentNode = parentNode.parentNode;
71 } 71 }
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index aa037bd4..2c34eedf 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -13,24 +13,14 @@ var Montage = require("montage/core/core").Montage,
13 TextDocument = require("js/document/document-text").TextDocument; 13 TextDocument = require("js/document/document-text").TextDocument;
14//////////////////////////////////////////////////////////////////////// 14////////////////////////////////////////////////////////////////////////
15// 15//
16var DocumentController = exports.DocumentController = Montage.create(Component, { 16exports.DocumentController = Montage.create(Component, {
17 hasTemplate: { 17 //
18 value: false 18 hasTemplate: {value: false},
19 }, 19 _documents: {value: []},
20 20 //TODO: what is this?!?!
21 _documents: { 21 _hackInitialStyles: {value: true},
22 value: []
23 },
24
25 _hackRootFlag: {
26 value: false
27 },
28
29 _hackInitialStyles: {
30 value: true
31 },
32
33 _activeDocument: { value: null }, 22 _activeDocument: { value: null },
23 //TODO: Are any of these needed?
34 _iframeCounter: { value: 1, enumerable: false }, 24 _iframeCounter: { value: 1, enumerable: false },
35 _iframeHolder: { value: null, enumerable: false }, 25 _iframeHolder: { value: null, enumerable: false },
36 _textHolder: { value: null, enumerable: false }, 26 _textHolder: { value: null, enumerable: false },
@@ -41,7 +31,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
41 return this._activeDocument; 31 return this._activeDocument;
42 }, 32 },
43 set: function(doc) { 33 set: function(doc) {
44// if(!!this._activeDocument){ this._activeDocument.isActive = false;} 34 //if(!!this._activeDocument){ this._activeDocument.isActive = false;}
45 35
46 this._activeDocument = doc; 36 this._activeDocument = doc;
47 37
@@ -53,7 +43,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
53 }, 43 },
54 44
55 deserializedFromTemplate: { 45 deserializedFromTemplate: {
56 value: function() { 46 value: function() { //TODO: Add event naming consistency (save, fileOpen and newFile should be consistent, all file events should be executeFile[operation name])
57 this.eventManager.addEventListener("appLoaded", this, false); 47 this.eventManager.addEventListener("appLoaded", this, false);
58 this.eventManager.addEventListener("executeFileOpen", this, false); 48 this.eventManager.addEventListener("executeFileOpen", this, false);
59 this.eventManager.addEventListener("executeNewFile", this, false); 49 this.eventManager.addEventListener("executeNewFile", this, false);
@@ -69,17 +59,22 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
69 59
70 60
71 //TODO: Ensure these APIs are not needed 61 //TODO: Ensure these APIs are not needed
62 redirectRequests: {
63 value: false
64 },
72 //////////////////////////////////////////////////////////////////// 65 ////////////////////////////////////////////////////////////////////
73 // 66 //
74 handleWebRequest: { 67 handleWebRequest: {
75 value: function (request) { 68 value: function (request) {
76 //TODO: Check if frameId is proper 69 //TODO: Check if frameId is proper
77 if (this._hackRootFlag && request.parentFrameId !== -1) { 70 if (this.redirectRequests && request.parentFrameId !== -1) {
78 //Checking for proper URL redirect (from different directories) 71 //Checking for proper URL redirect (from different directories)
79 if (request.url.indexOf('js/document/templates/banner') !== -1) { 72 if (request.url.indexOf('js/document/templates/banner') !== -1) {
80 return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/banner/'))[1]}; 73 return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/banner/'))[1]};
81 } else if (request.url.indexOf('js/document/templates/html') !== -1) { 74 } else if (request.url.indexOf('js/document/templates/html') !== -1) {
82 return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/html/'))[1]}; 75 return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/html/'))[1]};
76 } else if (request.url.indexOf('js/document/templates/app') !== -1) {
77 return {redirectUrl: this.application.ninja.coreIoApi.rootUrl+this.application.ninja.documentController.documentHackReference.root.split(this.application.ninja.coreIoApi.cloudData.root)[1]+request.url.split(chrome.extension.getURL('js/document/templates/app/'))[1]};
83 } else { 78 } else {
84 //Error, not a valid folder 79 //Error, not a valid folder
85 } 80 }
@@ -103,7 +98,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
103 }, 98 },
104 //////////////////////////////////////////////////////////////////// 99 ////////////////////////////////////////////////////////////////////
105 100
106
107 101
108 102
109 103
@@ -150,7 +144,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
150 // 144 //
151 saveExecuted: { 145 saveExecuted: {
152 value: function (value) { 146 value: function (value) {
153 //File saved, any callbacks or events should go here 147 //File saved, any callbacks or events should go here (must be added in handleExecuteSave passed as callback)
154 } 148 }
155 }, 149 },
156 //////////////////////////////////////////////////////////////////// 150 ////////////////////////////////////////////////////////////////////
@@ -160,9 +154,9 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
160 // 154 //
161 if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ 155 if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){
162 // 156 //
163 this.activeDocument.model.saveAll(this.testCallback.bind(this)); //this.fileSaveResult.bind(this) 157 this.activeDocument.model.saveAll();
164 } else { 158 } else {
165 //Error: 159 //TODO: Add error handling
166 } 160 }
167 } 161 }
168 }, 162 },
@@ -182,38 +176,22 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
182 handleExecuteFileClose:{ 176 handleExecuteFileClose:{
183 value: function(event) { 177 value: function(event) {
184 if (this.activeDocument) { 178