aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 f3eedfd0..ea7238fc 100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.js
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.js
@@ -64,16 +64,27 @@ exports.Breadcrumb = Montage.create(Component, {
64 64
65 parentNode = this.container; 65 parentNode = this.container;
66 66
67 while(parentNode.id !== "UserContent") { 67 // This is for the old template support.
68 // TODO: Remove marker for old template: NINJA-STAGE-REWORK
69 if(this.application.ninja.currentDocument.documentRoot.id === "UserContent") {
70 while(parentNode.id !== "UserContent") {
71 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName});
72 parentNode = parentNode.parentNode;
73 }
74
75 // This is always the top container which is now hardcoded to body
76 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": "Body"});
77 } else {
78 while(parentNode !== this.application.ninja.currentDocument.documentRoot) {
79 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName});
80 parentNode = parentNode.parentNode;
81 }
82
83 // This is always the top container which is now hardcoded to body
68 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName}); 84 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": parentNode.nodeName});
69 parentNode = parentNode.parentNode; 85 console.log("this works!");
70 } 86 }
71 87
72 // This is always the top container which is now hardcoded to body
73 this.containerElements.unshift({"node": parentNode, "nodeUuid":parentNode.uuid, "label": "Body"});
74// NJevent("breadCrumbBinding",this)
75
76
77 } 88 }
78 }, 89 },
79 90
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: { 385 openProjectWithURI: {
@@ -428,11 +481,13 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
428 481
429 this.activeDocument = doc; 482 this.activeDocument = doc;
430 483
431 this._showCurrentDocument();