diff options
author | Ananya Sen | 2012-04-04 15:14:33 -0700 |
---|---|---|
committer | Ananya Sen | 2012-04-04 15:14:33 -0700 |
commit | d5b429f4d1fad1f9b83e81d2d742d43ec39bd585 (patch) | |
tree | 219b269427fd6dd3887f7782192c932f2b468dad | |
parent | 8482e23cd9b8c4700b5130f2588e5eb24d376536 (diff) | |
download | ninja-d5b429f4d1fad1f9b83e81d2d742d43ec39bd585.tar.gz |
[CR] Keep Save related menu items always enabled, if there is an open document
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
-rwxr-xr-x | js/controllers/document-controller.js | 9 | ||||
-rwxr-xr-x | js/data/menu-data.js | 14 | ||||
-rwxr-xr-x | js/document/text-document.js | 4 |
3 files changed, 9 insertions, 18 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index a308f191..0f02ca3c 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -32,9 +32,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
32 | _iframeHolder: { value: null, enumerable: false }, | 32 | _iframeHolder: { value: null, enumerable: false }, |
33 | _textHolder: { value: null, enumerable: false }, | 33 | _textHolder: { value: null, enumerable: false }, |
34 | _codeMirrorCounter: {value: 1, enumerable: false}, | 34 | _codeMirrorCounter: {value: 1, enumerable: false}, |
35 | |||
36 | canSave:{value: false},//for Save menu state update | ||
37 | canSaveAll:{value: false},//for Save All menu state update | ||
38 | 35 | ||
39 | activeDocument: { | 36 | activeDocument: { |
40 | get: function() { | 37 | get: function() { |
@@ -50,12 +47,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, | |||
50 | if(!!this._activeDocument.editor){ | 47 | if(!!this._activeDocument.editor){ |
51 | this._activeDocument.editor.focus(); | 48 | this._activeDocument.editor.focus(); |
52 | } | 49 | } |
53 | |||
54 | this.canSave = doc.needsSave; | ||
55 | this.canSaveAll = doc.needsSave; | ||
56 | }else{ | ||
57 | this.canSave = false; | ||
58 | this.canSaveAll = false; | ||
59 | } | 50 | } |
60 | } | 51 | } |
61 | }, | 52 | }, |
diff --git a/js/data/menu-data.js b/js/data/menu-data.js index 3333d209..a1fe2703 100755 --- a/js/data/menu-data.js +++ b/js/data/menu-data.js | |||
@@ -70,8 +70,12 @@ exports.MenuData = Montage.create( Montage, { | |||
70 | "enabled": { | 70 | "enabled": { |
71 | "value": false, | 71 | "value": false, |
72 | "boundObj": "documentController", | 72 | "boundObj": "documentController", |
73 | "boundProperty": "canSave", | 73 | "boundProperty": "activeDocument", |
74 | "oneway": true | 74 | "oneway": true, |
75 | "boundValueMutator": function(activeDocument){ | ||
76 | if(activeDocument !== null){return true;} | ||
77 | else{return false;} | ||
78 | } | ||
75 | }, | 79 | }, |
76 | "action": "executeSave" | 80 | "action": "executeSave" |
77 | }, | 81 | }, |
@@ -96,10 +100,10 @@ exports.MenuData = Montage.create( Montage, { | |||
96 | "enabled": { | 100 | "enabled": { |
97 | "value": false, | 101 | "value": false, |
98 | "boundObj": "documentController", | 102 | "boundObj": "documentController", |
99 | "boundProperty": "canSaveAll", | 103 | "boundProperty": "activeDocument", |
100 | "oneway": true, | 104 | "oneway": true, |
101 | "boundValueMutator": function(canSaveAll){ | 105 | "boundValueMutator": function(activeDocument){ |
102 | if(canSaveAll === true){return true;} | 106 | if(activeDocument !== null){return true;} |
103 | else{return false;} | 107 | else{return false;} |
104 | } | 108 | } |
105 | }, | 109 | }, |
diff --git a/js/document/text-document.js b/js/document/text-document.js index 54a53999..2574b67c 100755 --- a/js/document/text-document.js +++ b/js/document/text-document.js | |||
@@ -164,11 +164,7 @@ var TextDocument = exports.TextDocument = Montage.create(Component, { | |||
164 | needsSave: { | 164 | needsSave: { |
165 | get: function() { return this._needsSave; }, | 165 | get: function() { return this._needsSave; }, |
166 | set: function(value) { | 166 | set: function(value) { |
167 | var i=0, canSaveAll=false; | ||
168 | this._needsSave = value; | 167 | this._needsSave = value; |
169 | |||
170 | this.application.ninja.documentController.canSave = value;//for save menu state update | ||
171 | this.application.ninja.documentController.canSaveAll = value;//for save menu state update..currently save all is tried to the current document only | ||
172 | } | 168 | } |
173 | }, | 169 | }, |
174 | 170 | ||