aboutsummaryrefslogtreecommitdiff
path: root/js/panels
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/panels
parentd8840eda0d3b3e31fb5a72306fe66608f4f99c2b (diff)
downloadninja-31b094ee21102f99a4021d505bc3a28527c9e23d.tar.gz
Fixing the close document.
Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/panels')
-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
6 files changed, 53 insertions, 29 deletions
diff --git a/js/panels/Panel.reel/Panel.js b/js/panels/Panel.reel/Panel.js
index 14b25c36..0c5f0b4b 100755
--- a/js/panels/Panel.reel/Panel.js
+++ b/js/panels/Panel.reel/Panel.js
@@ -120,7 +120,12 @@ exports.Panel = Montage.create(Component, {
120 this.panelContent.content[0].controller.currentDocument = this._currentDocument; 120 this.panelContent.content[0].controller.currentDocument = this._currentDocument;
121 } 121 }
122 122
123 this.disabled = this._currentDocument.currentView !== "design"; 123 if(!value) {
124 this.disabled = true;
125 } else {
126 this.disabled = this._currentDocument.currentView !== "design";
127 }
128
124 } 129 }
125 }, 130 },
126 131
diff --git a/js/panels/PanelContainer.reel/PanelContainer.js b/js/panels/PanelContainer.reel/PanelContainer.js
index dc501a99..7cb03255 100755
--- a/js/panels/PanelContainer.reel/PanelContainer.js
+++ b/js/panels/PanelContainer.reel/PanelContainer.js
@@ -81,8 +81,6 @@ exports.PanelContainer = Montage.create(Component, {
81 } 81 }
82 82
83 this.application.localStorage.setItem("panels", this.currentPanelState); 83 this.application.localStorage.setItem("panels", this.currentPanelState);
84
85 this.eventManager.addEventListener( "closeDocument", this, false);
86 } 84 }
87 }, 85 },
88 86
@@ -104,16 +102,6 @@ exports.PanelContainer = Montage.create(Component, {
104 } 102 }
105 }, 103 },
106 104
107 handleCloseDocument: {
108 value: function(){
109 if(!this.application.ninja.documentController.activeDocument) {
110 this.panels.forEach(function(obj) {
111 obj.disabled = true;
112 });
113 }
114 }
115 },
116
117 handleDropped: { 105 handleDropped: {
118 value: function(e) { 106 value: function(e) {
119 var draggedIndex, droppedIndex = 0, len = this.panels.length; 107 var draggedIndex, droppedIndex = 0, len = this.panels.length;
diff --git a/js/panels/css-panel/css-panel.reel/css-panel.html b/js/panels/css-panel/css-panel.reel/css-panel.html
index 42dca8a2..789635a0 100644
--- a/js/panels/css-panel/css-panel.reel/css-panel.html
+++ b/js/panels/css-panel/css-panel.reel/css-panel.html
@@ -31,6 +31,9 @@ No rights, expressed or implied, whatsoever to this software are provided by Mot
31 "properties": { 31 "properties": {
32 "element": {"#": "styles-view-container" }, 32 "element": {"#": "styles-view-container" },
33 "selectionName": {"@": "selectionName" } 33 "selectionName": {"@": "selectionName" }
34 },
35 "bindings": {
36 "currentDocument" : {"<-": "@owner.currentDocument" }
34 } 37 }
35 }, 38 },
36 "selectionName" : { 39 "selectionName" : {
diff --git a/js/panels/css-panel/css-panel.reel/css-panel.js b/js/panels/css-panel/css-panel.reel/css-panel.js
index a117787e..96d94b36 100644
--- a/js/panels/css-panel/css-panel.reel/css-panel.js
+++ b/js/panels/css-panel/css-panel.reel/css-panel.js
@@ -8,6 +8,24 @@ var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component; 8 Component = require("montage/ui/component").Component;
9 9
10exports.CssPanel = Montage.create(Component, { 10exports.CssPanel = Montage.create(Component, {
11
12 _currentDocument: {
13 value : null
14 },
15
16 currentDocument : {
17 get : function() {
18 return this._currentDocument;
19 },
20 set : function(value) {
21 if (value === this._currentDocument) {
22 return;
23 }
24
25 this._currentDocument = value;
26 }
27 },
28
11 prepareForDraw : { 29 prepareForDraw : {
12 value: function() { 30 value: function() {
13 } 31 }
diff --git a/js/panels/css-panel/styles-view-container.reel/styles-view-container.js b/js/panels/css-panel/styles-view-container.reel/styles-view-container.js
index 4a391421..157d99de 100644
--- a/js/panels/css-panel/styles-view-container.reel/styles-view-container.js
+++ b/js/panels/css-panel/styles-view-container.reel/styles-view-container.js
@@ -8,6 +8,29 @@ var Montage = require("montage/core/core").Montage,
8 Component = require("montage/ui/component").Component; 8 Component = require("montage/ui/component").Component;
9 9
10exports.StylesViewContainer = Montage.create(Component, { 10exports.StylesViewContainer = Montage.create(Component, {
11
12 _currentDocument: {
13 value : null
14 },
15
16 currentDocument : {
17 get : function() {
18 return this._currentDocument;
19 },
20 set : function(value) {
21 if (value === this._currentDocument) {
22 return;
23 }
24
25 this._currentDocument = value;
26
27 if(!value) {
28 this.hasStyles = false;
29 this.needsDraw = true;
30 }
31 }
32 },
33
11 contentController : { 34 contentController : {
12 value: null 35 value: null
13 }, 36 },
@@ -74,7 +97,6 @@ exports.StylesViewContainer = Montage.create(Component, {
74 value: function() { 97 value: function() {
75 this.eventManager.addEventListener('styleSheetsReady', this, false); 98 this.eventManager.addEventListener('styleSheetsReady', this, false);
76 this.eventManager.addEventListener('elementChange', this, false); 99 this.eventManager.addEventListener('elementChange', this, false);
77 this.eventManager.addEventListener("closeDocument", this, false);
78 } 100 }
79 }, 101 },
80 handleStyleSheetsReady: { 102 handleStyleSheetsReady: {
@@ -150,13 +172,6 @@ exports.StylesViewContainer = Montage.create(Component, {
150 } 172 }
151 }, 173 },
152 174
153 handleCloseDocument: {
154 value: function(e) {
155 this.hasStyles = false;
156 this.needsDraw = true;
157 }
158 },
159
160 draw : { 175 draw : {
161 value: function() { 176 value: function() {
162 if(this.hasStyles) { 177 if(this.hasStyles) {
diff --git a/js/panels/properties.reel/properties.js b/js/panels/properties.reel/properties.js
index e99f58e9..4b663220 100755
--- a/js/panels/properties.reel/properties.js
+++ b/js/panels/properties.reel/properties.js
@@ -29,7 +29,9 @@ exports.Properties = Montage.create(Component, {
29 29
30 this._currentDocument = value; 30 this._currentDocument = value;
31 31
32 if(this._currentDocument.currentView === "design") { 32 if(!value) {
33 this.clear();
34 } else if(this._currentDocument.currentView === "design") {
33 // Save a reference of the pi inside the document view to be able to clear 35 // Save a reference of the pi inside the document view to be able to clear
34 this._currentDocument.model.views.design.propertiesPanel = this; 36 this._currentDocument.model.views.design.propertiesPanel = this;
35 37
@@ -74,7 +76,6 @@ exports.Properties = Montage.create(Component, {
74 value : function() { 76 value : function() {
75 this.eventManager.addEventListener("elementChange", this, false); 77 this.eventManager.addEventListener("elementChange", this, false);
76 this.eventManager.addEventListener("selectionChange", this, false); 78 this.eventManager.addEventListener("selectionChange", this, false);
77 this.eventManager.addEventListener("closeDocument", this, false);
78 79
79 // This will be a toggle option 80 // This will be a toggle option
80 if(this.application.ninja.appData.PILiveUpdate) { 81 if(this.application.ninja.appData.PILiveUpdate) {
@@ -91,12 +92,6 @@ exports.Properties = Montage.create(Component, {
91 } 92 }
92 }, 93 },
93 94
94 handleCloseDocument: {
95 value: function(){
96 this.clear();
97 }
98 },
99
100 /** 95 /**
101 * Blur and Key up to handle change in the Element ID field. 96 * Blur and Key up to handle change in the Element ID field.
102 */ 97 */