From d5b429f4d1fad1f9b83e81d2d742d43ec39bd585 Mon Sep 17 00:00:00 2001 From: Ananya Sen Date: Wed, 4 Apr 2012 15:14:33 -0700 Subject: [CR] Keep Save related menu items always enabled, if there is an open document Signed-off-by: Ananya Sen --- js/controllers/document-controller.js | 9 --------- js/data/menu-data.js | 14 +++++++++----- 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, _iframeHolder: { value: null, enumerable: false }, _textHolder: { value: null, enumerable: false }, _codeMirrorCounter: {value: 1, enumerable: false}, - - canSave:{value: false},//for Save menu state update - canSaveAll:{value: false},//for Save All menu state update activeDocument: { get: function() { @@ -50,12 +47,6 @@ var DocumentController = exports.DocumentController = Montage.create(Component, if(!!this._activeDocument.editor){ this._activeDocument.editor.focus(); } - - this.canSave = doc.needsSave; - this.canSaveAll = doc.needsSave; - }else{ - this.canSave = false; - this.canSaveAll = false; } } }, 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, { "enabled": { "value": false, "boundObj": "documentController", - "boundProperty": "canSave", - "oneway": true + "boundProperty": "activeDocument", + "oneway": true, + "boundValueMutator": function(activeDocument){ + if(activeDocument !== null){return true;} + else{return false;} + } }, "action": "executeSave" }, @@ -96,10 +100,10 @@ exports.MenuData = Montage.create( Montage, { "enabled": { "value": false, "boundObj": "documentController", - "boundProperty": "canSaveAll", + "boundProperty": "activeDocument", "oneway": true, - "boundValueMutator": function(canSaveAll){ - if(canSaveAll === true){return true;} + "boundValueMutator": function(activeDocument){ + if(activeDocument !== null){return true;} else{return false;} } }, 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, { needsSave: { get: function() { return this._needsSave; }, set: function(value) { - var i=0, canSaveAll=false; this._needsSave = value; - - this.application.ninja.documentController.canSave = value;//for save menu state update - this.application.ninja.documentController.canSaveAll = value;//for save menu state update..currently save all is tried to the current document only } }, -- cgit v1.2.3