aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-29 15:32:47 -0700
committerValerio Virgillito2012-05-29 15:32:47 -0700
commit5d7dff15e1e603e3b37057b9843e4b1eef1b2dca (patch)
tree25c2a5a1b4a273fc32a555cf662b6963a5770885 /js/controllers
parent4fa08fe2ce439a5f5c248c568f72d3828ee11b36 (diff)
downloadninja-5d7dff15e1e603e3b37057b9843e4b1eef1b2dca.tar.gz
cleanup and handling the document views in the document controller for now.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/document-controller.js60
1 files changed, 26 insertions, 34 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 948e4550..eba950b9 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -22,6 +22,30 @@ exports.DocumentController = Montage.create(Component, {
22 value: [] 22 value: []
23 }, 23 },
24 24
25 _currentDocument: {
26 value : null
27 },
28
29 currentDocument : {
30 get : function() {
31 return this._currentDocument;
32 },
33 set : function(value) {
34 if (value === this._currentDocument || value.getProperty("currentView") !== "design") {
35 return;
36 }
37
38 if(this._currentDocument) {
39 this._currentDocument.model.currentView.hide();
40 }
41
42 this._currentDocument = value;
43
44 this._currentDocument.model.currentView.show();
45
46 }
47 },
48
25 deserializedFromTemplate: { 49 deserializedFromTemplate: {
26 value: function() { //TODO: Add event naming consistency (save, fileOpen and newFile should be consistent, all file events should be executeFile[operation name]) 50 value: function() { //TODO: Add event naming consistency (save, fileOpen and newFile should be consistent, all file events should be executeFile[operation name])
27 this.eventManager.addEventListener("appLoaded", this, false); 51 this.eventManager.addEventListener("appLoaded", this, false);
@@ -280,11 +304,11 @@ exports.DocumentController = Montage.create(Component, {
280 304
281 //Open in designer view 305 //Open in designer view
282 this.redirectRequests = false; 306 this.redirectRequests = false;
283 Montage.create(HTMLDocument).init(file, this, this._onOpenDocument, 'design', template); 307 Montage.create(HTMLDocument).init(file, this.application.ninja, this.application.ninja.openDocument, 'design', template);
284 break; 308 break;
285 default: 309 default:
286 //Open in code view 310 //Open in code view
287 Montage.create(TextDocument).init(file, this, this._onOpenTextDocument, 'code'); 311 Montage.create(TextDocument).init(file, this.application.ninja, this.application.ninja.openDocument, 'code');
288 break; 312 break;
289 } 313 }
290 } 314 }
@@ -365,42 +389,10 @@ exports.DocumentController = Montage.create(Component, {
365 } 389 }
366 }, 390 },
367 391
368 // Open document callback
369 _onOpenDocument: {
370 value: function(doc){
371
372
373 // Bypass all and call main.
374 // TODO: Call ninja directly once this is all cleaned up.
375
376 this.application.ninja.handleOnOpenDocument(doc);
377
378
379// var currentDocument;
380// if(this.activeDocument) {
381 // There is a document currently opened
382// currentDocument = this.activeDocument;
383// } else {
384 // There is no document opened
385
386// }
387
388 // Set the active document
389// this.activeDocument = doc;
390
391
392// this.switchDocuments(currentDocument, doc, true);
393
394
395 }
396 },
397
398 392
399 _onOpenTextDocument: { 393 _onOpenTextDocument: {
400 value: function(doc) { 394 value: function(doc) {
401 395
402 this.application.ninja.handleOnOpenDocument(doc);
403
404 // Main DIFFERENCE -- 396 // Main DIFFERENCE --
405 // TODO: Implement Code View here 397 // TODO: Implement Code View here
406 //document.getElementById("iframeContainer").style.display = "none"; 398 //document.getElementById("iframeContainer").style.display = "none";