aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNivesh Rajbhandari2012-05-17 11:10:15 -0700
committerNivesh Rajbhandari2012-05-17 11:10:15 -0700
commit3d36ca3feb7a2cabd7d64335b2417637bd9aa906 (patch)
treeb89119d747de0c7333a8cbde4a7689c5fb102d5c
parent2ba4a6fab3b81b537521760ee5f95f1bc80027f9 (diff)
parent0e8ca026098e7abfaeb642643a21977490782922 (diff)
downloadninja-3d36ca3feb7a2cabd7d64335b2417637bd9aa906.tar.gz
Merge branch 'refs/heads/dom-architecture-master' into Dom-Architecture
-rwxr-xr-xjs/components/ui/label-checkbox.reel/label-checkbox.js22
-rwxr-xr-xjs/controllers/document-controller.js225
-rwxr-xr-xjs/data/menu-data.js4
-rwxr-xr-xjs/document/document-html.js21
-rwxr-xr-xjs/document/html-document.js26
-rwxr-xr-xjs/document/models/base.js6
-rwxr-xr-xjs/document/models/html.js5
-rw-r--r--js/document/templates/html/main.js4
-rw-r--r--js/mediators/io-mediator.js84
-rw-r--r--js/panels/Timeline/TimelinePanel.reel/TimelinePanel.js2
-rwxr-xr-xjs/panels/components-panel.reel/components-panel.js6
-rwxr-xr-xjs/panels/properties.reel/sections/custom.reel/custom.js8
-rwxr-xr-xjs/stage/stage-view.reel/stage-view.js50
13 files changed, 190 insertions, 273 deletions
diff --git a/js/components/ui/label-checkbox.reel/label-checkbox.js b/js/components/ui/label-checkbox.reel/label-checkbox.js
index 82c01262..21b72cb5 100755
--- a/js/components/ui/label-checkbox.reel/label-checkbox.js
+++ b/js/components/ui/label-checkbox.reel/label-checkbox.js
@@ -42,6 +42,25 @@ exports.LabelCheckbox = Montage.create(Component, {
42 } 42 }
43 }, 43 },
44 44
45 _enabled: {
46 enumerable: false,
47 value: true
48 },
49
50 enabled: {
51 enumerable: true,
52 serializable: true,
53 get: function() {
54 return this._enabled;
55 },
56 set: function(value) {
57 if(value !== this._enabled) {
58 this._enabled = value;
59 this.needsDraw = true;
60 }
61 }
62 },
63
45 value: { 64 value: {
46 value: false 65 value: false
47 }, 66 },
@@ -52,7 +71,7 @@ exports.LabelCheckbox = Montage.create(Component, {
52 e.initEvent("change", true, true); 71 e.initEvent("change", true, true);
53 e.type = "change"; 72 e.type = "change";
54 e.wasSetByCode = false; 73 e.wasSetByCode = false;
55 this.value = e.value = this._checkbox.checked; 74 this.checked = this.value = e.value = this._checkbox.checked;
56 this.dispatchEvent(e); 75 this.dispatchEvent(e);
57 } 76 }
58 }, 77 },
@@ -61,6 +80,7 @@ exports.LabelCheckbox = Montage.create(Component, {
61 value: function() { 80 value: function() {
62 this._labelText.value = this.label; 81 this._labelText.value = this.label;
63 this._checkbox.checked = this.checked; 82 this._checkbox.checked = this.checked;
83 this._checkbox.disabled = !this._enabled;
64 } 84 }
65 85
66 } 86 }
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 1e894f02..cf46e73e 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -21,10 +21,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
21 value: false 21 value: false
22 }, 22 },
23 23
24 webTemplate: {
25 value: false
26 },
27
28 _documents: { 24 _documents: {
29 value: [] 25 value: []
30 }, 26 },
@@ -75,10 +71,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
75 this.eventManager.addEventListener("executeFileCloseAll", this, false); 71 this.eventManager.addEventListener("executeFileCloseAll", this, false);
76 72
77 this.eventManager.addEventListener("styleSheetDirty", this, false); 73 this.eventManager.addEventListener("styleSheetDirty", this, false);
78
79 // Temporary add listeners for the new stage templates
80 this.eventManager.addEventListener("executeWebpageOpen", this, false);
81 this.eventManager.addEventListener("executeNewWebpage", this, false);
82 } 74 }
83 }, 75 },
84 76
@@ -138,20 +130,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
138 } 130 }
139 }, 131 },
140 132
141 handleExecuteWebpageOpen: {
142 value: function(event) {
143 this.webTemplate = true;
144 this.handleExecuteFileOpen(event);
145 }
146 },
147
148 handleExecuteNewWebpage: {
149 value: function(event) {
150 this.webTemplate = true;
151 this.handleExecuteNewFile(event);
152 }
153 },
154
155 handleExecuteNewFile: { 133 handleExecuteNewFile: {
156 value: function(event) { 134 value: function(event) {
157 var newFileSettings = event._event.settings || {}; 135 var newFileSettings = event._event.settings || {};
@@ -177,6 +155,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
177 testCallback: { 155 testCallback: {
178 value: function (value) { 156 value: function (value) {
179 console.log(value); 157 console.log(value);
158 //TODO: Move this to the model.save()
159 this.activeDocument.model.needsSave = false;
180 } 160 }
181 }, 161 },
182 //////////////////////////////////////////////////////////////////// 162 ////////////////////////////////////////////////////////////////////
@@ -302,12 +282,8 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
302 this.isNewFilePath = false;//reset path identifier flag 282 this.isNewFilePath = false;//reset path identifier flag
303 283
304 //Sending full response object 284 //Sending full response object
305 // TODO: Unify those 2 methods. Using if/else for the new template 285 this.openDocument(response);
306 if(this.webTemplate) { 286
307 this.openWebDocument(response);
308 } else {
309 this.openDocument(response);
310 }
311 } else if (!!response && (response.status === 404)){ 287 } else if (!!response && (response.status === 404)){
312 alert("Unable to open file.\n [Error: File does not exist]"); 288 alert("Unable to open file.\n [Error: File does not exist]");
313 } else if (!!response && (response.status === 500)){ 289 } else if (!!response && (response.status === 500)){
@@ -343,30 +319,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
343 }, 319 },
344 320
345 //////////////////////////////////////////////////////////////////// 321 ////////////////////////////////////////////////////////////////////
346 openDocument: { 322 openDocument: {
347 value: function(doc) {
348
349 //
350 this.documentHackReference = doc;
351 //
352 switch (doc.extension) {
353 case 'html':
354 //Open in designer view
355 Montage.create(HTMLDocument).initialize(doc, Uuid.generate(), this._createIframeElement(), this._onOpenDocument.bind(this));
356 break;
357 default:
358 //Open in code view
359 var code = Montage.create(TextDocument, {"source": {value: doc.content}}), docuuid = Uuid.generate(), textArea;
360 textArea = this.application.ninja.stage.stageView.createTextAreaElement(docuuid);
361 code.initialize(doc, docuuid, textArea, textArea.parentNode);
362 //code.init(doc.name, doc.uri, doc.extension, null, docuuid);
363 code.textArea.value = doc.content;
364 this.application.ninja.stage.stageView.createTextView(code);
365 break;
366 }
367 }
368 },
369 openWebDocument: {
370 value: function(doc) { 323 value: function(doc) {
371 var template, dimensions; 324 var template, dimensions;
372 if (doc.content.body.indexOf('Ninja-Banner Dimensions@@@') !== -1) { 325 if (doc.content.body.indexOf('Ninja-Banner Dimensions@@@') !== -1) {
@@ -482,14 +435,14 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
482 } 435 }
483 this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]); 436 this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]);
484 if(typeof doc.stopVideos !== "undefined"){doc.stopVideos();} 437 if(typeof doc.stopVideos !== "undefined"){doc.stopVideos();}
485 this._removeDocumentView(doc.container); 438 doc.container.parentNode.removeChild(doc.container);
486 }else if(this._documents.length === 0){ 439 }else if(this._documents.length === 0){
487 // See above 440 // See above
488 }else{//closing inactive document tab - just clear DOM 441 }else{//closing inactive document tab - just clear DOM
489 if(typeof doc.pauseAndStopVideos !== "undefined"){ 442 if(typeof doc.pauseAndStopVideos !== "undefined"){
490 doc.pauseAndStopVideos(); 443 doc.pauseAndStopVideos();
491 } 444 }
492 this._removeDocumentView(doc.container); 445 doc.container.parentNode.removeChild(doc.container);
493 } 446 }
494 447
495 NJevent("closeDocument", doc.uri); 448 NJevent("closeDocument", doc.uri);
@@ -498,41 +451,79 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
498 } 451 }
499 }, 452 },
500 453
501 // Document has been loaded into the Iframe. Dispatch the event. 454 // Open document callback
502 // Event Detail: Contains the current ActiveDocument
503 _onOpenDocument: { 455 _onOpenDocument: {
504 value: function(doc){ 456 value: function(doc){