aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorValerio Virgillito2012-05-30 01:33:20 -0700
committerValerio Virgillito2012-05-30 01:33:20 -0700
commit31b094ee21102f99a4021d505bc3a28527c9e23d (patch)
treea9525ea312f8cc0d25ab6410394f01e974b69068 /js
parentd8840eda0d3b3e31fb5a72306fe66608f4f99c2b (diff)
downloadninja-31b094ee21102f99a4021d505bc3a28527c9e23d.tar.gz
Fixing the close document.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js')
-rwxr-xr-xjs/components/layout/bread-crumb.reel/bread-crumb.js16
-rwxr-xr-xjs/components/layout/document-bar.reel/document-bar.js15
-rwxr-xr-xjs/components/layout/document-entry.reel/document-entry.js11
-rwxr-xr-xjs/controllers/document-controller.js72
-rwxr-xr-xjs/controllers/selection-controller.js1
-rwxr-xr-xjs/ninja.reel/ninja.js8
-rwxr-xr-xjs/panels/Panel.reel/Panel.js7
-rwxr-xr-xjs/panels/PanelContainer.reel/PanelContainer.js12
-rw-r--r--js/panels/css-panel/css-panel.reel/css-panel.html3
-rw-r--r--js/panels/css-panel/css-panel.reel/css-panel.js18
-rw-r--r--js/panels/css-panel/styles-view-container.reel/styles-view-container.js31
-rwxr-xr-xjs/panels/properties.reel/properties.js11
-rwxr-xr-xjs/stage/layout.js6
-rwxr-xr-xjs/stage/stage-deps.js7
-rwxr-xr-xjs/stage/stage.reel/stage.js14
15 files changed, 88 insertions, 144 deletions
diff --git a/js/components/layout/bread-crumb.reel/bread-crumb.js b/js/components/layout/bread-crumb.reel/bread-crumb.js
index 74e89ac1..ac131f2c 100755
--- a/js/components/layout/bread-crumb.reel/bread-crumb.js
+++ b/js/components/layout/bread-crumb.reel/bread-crumb.js
@@ -26,12 +26,12 @@ exports.Breadcrumb = Montage.create(Component, {
26 26
27 this._currentDocument = value; 27 this._currentDocument = value;
28 28
29 if(!this._currentDocument) { 29 if(!value) {
30 this.disabled = true; 30 this.disabled = true;
31 } else {
32 this.disabled = this._currentDocument.currentView !== "design";
31 } 33 }
32 34
33 this.disabled = this._currentDocument.currentView !== "design";
34
35 } 35 }
36 }, 36 },
37 37
@@ -51,15 +51,6 @@ exports.Breadcrumb = Montage.create(Component, {
51 } 51 }
52 }, 52 },
53 53
54 handleCloseDocument: {
55 value: function(){
56 if(!this.application.ninja.documentController.activeDocument && this.application.ninja.currentDocument.currentView !== "code") {
57 this.disabled = true;
58 this.application.ninja.currentSelectedContainer = (this.application.ninja.currentDocument ? this.application.ninja.currentDocument.model.documentRoot : null);
59 }
60 }
61 },
62
63 _container:{ 54 _container:{
64 value:null 55 value:null
65 }, 56 },
@@ -82,7 +73,6 @@ exports.Breadcrumb = Montage.create(Component, {
82 73
83 prepareForDraw: { 74 prepareForDraw: {
84 value: function() { 75 value: function() {
85 this.eventManager.addEventListener("closeDocument", this, false);
86 this.breadcrumbBt.addEventListener("action", this, false); 76 this.breadcrumbBt.addEventListener("action", this, false);
87 } 77 }
88 }, 78 },
diff --git a/js/components/layout/document-bar.reel/document-bar.js b/js/components/layout/document-bar.reel/document-bar.js
index 6a7b0f3f..90d3a207 100755
--- a/js/components/layout/document-bar.reel/document-bar.js
+++ b/js/components/layout/document-bar.reel/document-bar.js
@@ -105,7 +105,6 @@ exports.DocumentBar = Montage.create(Component, {
105 105
106 prepareForDraw: { 106 prepareForDraw: {
107 value: function() { 107 value: function() {
108 this.eventManager.addEventListener( "closeDocument", this, false);
109 this.designView.addEventListener("click", this, false); 108 this.designView.addEventListener("click", this, false);
110 this.codeView.addEventListener("click", this, false); 109 this.codeView.addEventListener("click", this, false);
111 110
@@ -135,19 +134,5 @@ exports.DocumentBar = Montage.create(Component, {
135 this.currentView = event._event.target.id; 134 this.currentView = event._event.target.id;
136 this.application.ninja.documentController.stage.stageView.switchDesignDocViews(event._event.target.id);//switch between design view 135 this.application.ninja.documentController.stage.stageView.switchDesignDocViews(event._event.target.id);//switch between design view
137 } 136 }
138 },
139
140 handleCloseDocument: {
141 value: function() {
142 if(!this.application.ninja.documentController.activeDocument) {
143 this.disabled = true;
144 }
145 }
146 },
147
148 handleOnDocumentChanged:{
149 value:function(event){
150
151 }
152 } 137 }
153}); 138});
diff --git a/js/components/layout/document-entry.reel/document-entry.js b/js/components/layout/document-entry.reel/document-entry.js
index 34e307cb..94056007 100755
--- a/js/components/layout/document-entry.reel/document-entry.js
+++ b/js/components/layout/document-entry.reel/document-entry.js
@@ -9,10 +9,6 @@ var Component = require("montage/ui/component").Component;
9 9
10exports.DocumentEntry = Montage.create(Component, { 10exports.DocumentEntry = Montage.create(Component, {
11 11
12 _uuid: {
13 value: null
14 },
15
16 _document: { 12 _document: {
17 value: null 13 value: null
18 }, 14 },
@@ -23,16 +19,11 @@ exports.DocumentEntry = Montage.create(Component, {
23 return this._document; 19 return this._document;
24 }, 20 },
25 set: function(value) { 21 set: function(value) {
26
27 if (this._document === value) { 22 if (this._document === value) {
28 return; 23 return;
29 } 24 }
30 25
31 this._document = value; 26 this._document = value;
32
33 if(value) {
34 this._uuid = value.uuid;
35 }
36 } 27 }
37 }, 28 },
38 29
@@ -87,7 +78,7 @@ exports.DocumentEntry = Montage.create(Component, {
87 78
88 handleCloseButtonAction: { 79 handleCloseButtonAction: {
89 value: function() { 80 value: function() {
90 //this.application.ninja.documentController.closeFile(this.application.ninja.documentController._findDocumentByUUID(this._uuid)); 81 this.application.ninja.documentController.closeFile(this.document);
91 } 82 }
92 } 83 }
93 84
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index eba950b9..4f122b3b 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -31,7 +31,7 @@ exports.DocumentController = Montage.create(Component, {
31 return this._currentDocument; 31 return this._currentDocument;
32 }, 32 },
33 set : function(value) { 33 set : function(value) {
34 if (value === this._currentDocument || value.getProperty("currentView") !== "design") { 34 if (value === this._currentDocument) {
35 return; 35 return;
36 } 36 }
37 37
@@ -41,7 +41,13 @@ exports.DocumentController = Montage.create(Component, {
41 41
42 this._currentDocument = value; 42 this._currentDocument = value;
43 43
44 this._currentDocument.model.currentView.show(); 44 if(!value) {
45
46 } else {
47 this._currentDocument.model.currentView.show();
48 }
49
50
45 51
46 } 52 }
47 }, 53 },
@@ -323,7 +329,7 @@ exports.DocumentController = Montage.create(Component, {
323 329
324 closeFile: { 330 closeFile: {
325 value: function(document) { 331 value: function(document) {
326 document.closeDocument(this, this.onCloseFile); 332 document.closeDocument(this.application.ninja, this.application.ninja.closeFile);
327 } 333 }
328 }, 334 },
329 335
@@ -357,39 +363,6 @@ exports.DocumentController = Montage.create(Component, {
357 } 363 }
358 }, 364 },
359 365
360 closeDocument: {
361 value: function(id) {
362 var doc = this._findDocumentByUUID(id);
363
364 var closeDocumentIndex = this._findIndexByUUID(id);
365 this._documents.splice(this._findIndexByUUID(id), 1);
366
367 if(this.activeDocument.uuid === id && this._documents.length > 0) {//closing the active document tab
368 var nextDocumentIndex = -1 ;
369 if((this._documents.length > 0) && (closeDocumentIndex === 0)){
370 nextDocumentIndex = 0;
371 }else if((this._documents.length > 0) && (closeDocumentIndex > 0)){
372 nextDocumentIndex = closeDocumentIndex - 1;
373 }
374 this.application.ninja.stage.stageView.switchDocument(this._documents[nextDocumentIndex]);
375 if(typeof doc.stopVideos !== "undefined"){doc.stopVideos();}
376 doc.container.parentNode.removeChild(doc.container);
377 }else if(this._documents.length === 0){
378 // See above <