aboutsummaryrefslogtreecommitdiff
path: root/js/controllers
diff options
context:
space:
mode:
authorAnanya Sen2012-03-06 16:30:33 -0800
committerAnanya Sen2012-03-06 16:30:33 -0800
commit2364c671ffc2953e3ee8dfdf037244de8fab3920 (patch)
treedfdcc7d60b5d8627d6b41d0b37e66ad5cc75ba5b /js/controllers
parentfbde30a4651d34ac569bf6750db5dd017ccc8d6e (diff)
downloadninja-2364c671ffc2953e3ee8dfdf037244de8fab3920.tar.gz
IKNINJA-1238 fix and fixing other js errors on switching and closing documents
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/controllers')
-rwxr-xr-xjs/controllers/document-controller.js21
-rwxr-xr-xjs/controllers/selection-controller.js18
2 files changed, 30 insertions, 9 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 194496a6..1f8c58b0 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -61,7 +61,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
61 this.eventManager.addEventListener("executeSaveAs", this, false); 61 this.eventManager.addEventListener("executeSaveAs", this, false);
62 this.eventManager.addEventListener("executeSaveAll", this, false); 62 this.eventManager.addEventListener("executeSaveAll", this, false);
63 63
64 this.eventManager.addEventListener("recordStyleChanged", this, false); 64 this.eventManager.addEventListener("styleSheetDirty", this, false);
65 65
66 } 66 }
67 }, 67 },
@@ -168,6 +168,10 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
168 value: function (result) { 168 value: function (result) {
169 if(result.status === 204){ 169 if(result.status === 204){
170 this.activeDocument.needsSave = false; 170 this.activeDocument.needsSave = false;
171 if(this.application.ninja.currentDocument !== null){
172 //clear Dirty StyleSheets for the saved document
173 this.application.ninja.stylesController.clearDirtyStyleSheets(this.application.ninja.currentDocument);
174 }
171 } 175 }
172 } 176 }
173 }, 177 },
@@ -249,6 +253,15 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
249 }, 253 },
250 //////////////////////////////////////////////////////////////////// 254 ////////////////////////////////////////////////////////////////////
251 // 255 //
256 saveAsCallback:{
257 value:function(){
258 //close current document
259
260 //create a new file
261 }
262 },
263
264 ////////////////////////////////////////////////////////////////////
252 openDocument: { 265 openDocument: {
253 value: function(doc) { 266 value: function(doc) {
254 267
@@ -506,5 +519,11 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
506 value: function() { 519 value: function() {
507 return "userDocument_" + (this._iframeCounter++); 520 return "userDocument_" + (this._iframeCounter++);
508 } 521 }
522 },
523
524 handleStyleSheetDirty:{
525 value:function(){
526 this.activeDocument.needsSave = true;
509 } 527 }
528 }
510}); 529});
diff --git a/js/controllers/selection-controller.js b/js/controllers/selection-controller.js
index 08eb018f..3f9d8514 100755
--- a/js/controllers/selection-controller.js
+++ b/js/controllers/selection-controller.js
@@ -91,15 +91,17 @@ exports.SelectionController = Montage.create(Component, {
91 91
92 handleSwitchDocument: { 92 handleSwitchDocument: {
93 value: function() { 93 value: function() {
94 this._selectedItems = this.application.ninja.selectedElements.slice(0); 94 if(this.application.ninja.documentController.activeDocument.currentView === "design"){
95 if(this._selectedItems.length === 0 ){ 95 this._selectedItems = this.application.ninja.selectedElements.slice(0);
96 this._isDocument = true; 96 if(this._selectedItems.length === 0 ){
97 }else{ 97 this._isDocument = true;
98 this._isDocument = false; 98 }else{
99 } 99 this._isDocument = false;
100 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} ); 100 }
101 NJevent("selectionChange", {"elements": this.application.ninja.selectedElements, "isDocument": this._isDocument} );
101 102
102 this._selectionContainer = this.application.ninja.currentSelectedContainer; 103 this._selectionContainer = this.application.ninja.currentSelectedContainer;
104 }
103 } 105 }
104 }, 106 },
105 107