aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-04-24 10:06:45 -0700
committerJose Antonio Marquez2012-04-24 10:06:45 -0700
commit60c4f4e38cd0c516a0840bec416a688d0bad0d49 (patch)
tree3f383cb4b9e92dcb7f80eed62ff6cbc467062448
parentae4cc0daf3ed23ed2191ead1b795a5b0cc54a3a7 (diff)
parent55e6d621b9555abac06ab4adff44dfe29a78ec4e (diff)
downloadninja-60c4f4e38cd0c516a0840bec416a688d0bad0d49.tar.gz
Merge branch 'refs/heads/Ninja-Internal' into FileIO
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.js25
-rwxr-xr-xjs/controllers/document-controller.js73
-rwxr-xr-xjs/data/menu-data.js61
-rwxr-xr-xjs/document/controllers/document.js45
-rwxr-xr-xjs/document/document-html.js322
-rwxr-xr-xjs/document/document-text.js (renamed from js/document/controllers/base-controller.js)14
-rwxr-xr-xjs/document/html-document.js7
-rwxr-xr-xjs/document/mediators/io.js (renamed from js/document/mediators/base-mediator.js)14
-rwxr-xr-xjs/document/mediators/template.js (renamed from js/document/models/base-model.js)14
-rwxr-xr-xjs/document/models/base.js42
-rwxr-xr-xjs/document/models/html.js24
-rwxr-xr-xjs/document/models/text.js24
-rwxr-xr-xjs/document/templates/montage-web/default_html.css19
-rwxr-xr-xjs/document/templates/montage-web/index.html49
-rw-r--r--js/document/templates/montage-web/main.reel/main.js49
-rwxr-xr-xjs/document/templates/montage-web/package.json8
-rwxr-xr-xjs/document/views/base.js (renamed from js/document/views/base-view.js)14
-rwxr-xr-xjs/document/views/code.js25
-rwxr-xr-xjs/document/views/design.js25
-rwxr-xr-xjs/ninja.reel/ninja.js29
-rwxr-xr-xjs/panels/properties.reel/properties.js5
-rwxr-xr-xjs/stage/stage.reel/stage.js4
22 files changed, 783 insertions, 109 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/controllers/document-controller.js b/js/controllers/document-controller.js
index ddaeb061..4be0767a 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -10,8 +10,10 @@ var Montage = require("montage/core/core").Montage,
10 Component = require("montage/ui/component").Component, 10 Component = require("montage/ui/component").Component,
11 Uuid = require("montage/core/uuid").Uuid, 11 Uuid = require("montage/core/uuid").Uuid,
12 HTMLDocument = require("js/document/html-document").HTMLDocument, 12 HTMLDocument = require("js/document/html-document").HTMLDocument,
13 TextDocument = require("js/document/text-document").TextDocument, 13 TextDocument = require("js/document/text-document").TextDocument;
14 DocumentController; 14
15 // New Document Objects
16var Document = require("js/document/document-html").HtmlDocument;
15//////////////////////////////////////////////////////////////////////// 17////////////////////////////////////////////////////////////////////////
16// 18//
17var DocumentController = exports.DocumentController = Montage.create(Component, { 19var DocumentController = exports.DocumentController = Montage.create(Component, {
@@ -19,6 +21,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
19 value: false 21 value: false
20 }, 22 },
21 23
24 webTemplate: {
25 value: false
26 },
27
22 _documents: { 28 _documents: {
23 value: [] 29 value: []
24 }, 30 },
@@ -65,6 +71,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
65 this.eventManager.addEventListener("styleSheetDirty", this, false); 71 this.eventManager.addEventListener("styleSheetDirty", this, false);
66 72
67 this.eventManager.addEventListener("addComponentFirstDraw", this, false); 73 this.eventManager.addEventListener("addComponentFirstDraw", this, false);
74
75 // Temporary add listeners for the new stage templates
76 this.eventManager.addEventListener("executeWebpageOpen", this, false);
77 this.eventManager.addEventListener("executeNewWebpage", this, false);
68 } 78 }
69 }, 79 },
70 80
@@ -130,6 +140,20 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
130 } 140 }
131 }, 141 },
132 142
143 handleExecuteWebpageOpen: {
144 value: function(event) {
145 this.webTemplate = true;
146 this.handleExecuteFileOpen(event);
147 }
148 },
149
150 handleExecuteNewWebpage: {
151 value: function(event) {
152 this.webTemplate = true;
153 this.handleExecuteNewFile(event);
154 }
155 },
156
133 handleExecuteNewFile: { 157 handleExecuteNewFile: {
134 value: function(event) { 158 value: function(event) {
135 var newFileSettings = event._event.settings || {}; 159 var newFileSettings = event._event.settings || {};
@@ -235,7 +259,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
235 this.creatingNewFile = true;//flag for timeline to identify new file flow 259 this.creatingNewFile = true;//flag for timeline to identify new file flow
236 260
237 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); 261 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this));
238 }else if(!!response && !response.success){ 262 } else if(!!response && !response.success){
239 //Todo: restrict directory path to the sandbox, in the dialog itself 263 //Todo: restrict directory path to the sandbox, in the dialog itself
240 alert("Unable to create file.\n [Error: Forbidden directory]"); 264 alert("Unable to create file.\n [Error: Forbidden directory]");
241 } 265 }
@@ -268,7 +292,12 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
268 this.isNewFilePath = false;//reset path identifier flag 292 this.isNewFilePath = false;//reset path identifier flag
269 293
270 //Sending full response object 294 //Sending full response object
271 this.openDocument(response); 295 // TODO: Unify those 2 methods. Using if/else for the new template
296 if(this.webTemplate) {
297 this.openWebDocument(response);
298 } else {
299 this.openDocument(response);
300 }
272 } else if (!!response && (response.status === 404)){ 301 } else if (!!response && (response.status === 404)){
273 alert("Unable to open file.\n [Error: File does not exist]"); 302 alert("Unable to open file.\n [Error: File does not exist]");
274 } else if (!!response && (response.status === 500)){ 303 } else if (!!response && (response.status === 500)){
@@ -311,7 +340,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
311 this.documentHackReference = doc; 340 this.documentHackReference = doc;
312 // 341 //
313 switch (doc.extension) { 342 switch (doc.extension) {
314 case 'html': case 'html': 343 case 'html':
315 //Open in designer view 344 //Open in designer view
316 Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument.bind(this)); 345 Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument.bind(this));
317 break; 346 break;
@@ -327,6 +356,30 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
327 } 356 }
328 } 357 }
329 }, 358 },
359 openWebDocument: {
360 value: function(doc) {
361 // TODO: HACKS to remove
362 this.documentHackReference = doc;
363 document.getElementById("iframeContainer").style.overflow = "hidden";
364 //
365 switch (doc.extension) {
366 case 'html':
367 //Open in designer view
368 this._hackRootFlag = false;
369 Montage.create(Document).init(doc, this, this._onOpenDocument);
370 break;
371 default:
372 //Open in code view
373 var code = Montage.create(TextDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea;
374 textArea = this.application.ninja.stage.stageView.createTextAreaElement(docuuid);
375 code.initialize(doc, docuuid, textArea, textArea.parentNode);
376 //code.init(doc.name, doc.uri, doc.extension, null, docuuid);
377 code.textArea.value = doc.content;
378 this.application.ninja.stage.stageView.createTextView(code);
379 break;
380 }
381 }
382 },
330 //////////////////////////////////////////////////////////////////// 383 ////////////////////////////////////////////////////////////////////
331 384
332 openProjectWithURI: {