aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/document-controller.js
diff options
context:
space:
mode:
authorAnanya Sen2012-02-20 15:15:37 -0800
committerAnanya Sen2012-02-20 15:15:37 -0800
commit3251315ecc22544dab50623ee5862e00dfe02302 (patch)
tree7e4a470009f4a46b9f79f5e93dfe3ddf0bfabf12 /js/controllers/document-controller.js
parent50e555587d3a97dbfc75c33f3589cfccee392180 (diff)
downloadninja-3251315ecc22544dab50623ee5862e00dfe02302.tar.gz
check cloud availability before open file picker and new file dialogs
Signed-off-by: Ananya Sen <Ananya.Sen@motorola.com>
Diffstat (limited to 'js/controllers/document-controller.js')
-rwxr-xr-xjs/controllers/document-controller.js22
1 files changed, 15 insertions, 7 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index f8507086..e279d5c5 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -70,7 +70,7 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
70 value: function (request) { 70 value: function (request) {
71 if (request.url.indexOf('js/document/templates/montage-html') !== -1) { 71 if (request.url.indexOf('js/document/templates/montage-html') !== -1) {
72 72
73 console.log(request); 73 //console.log(request);
74 74
75 //TODO: Figure out why active document is not available here 75 //TODO: Figure out why active document is not available here
76 76
@@ -98,18 +98,26 @@ var DocumentController = exports.DocumentController = Montage.create(Component,
98 handleExecuteFileOpen: { 98 handleExecuteFileOpen: {
99 value: function(event) { 99 value: function(event) {
100 var pickerSettings = event._event.settings || {}; 100 var pickerSettings = event._event.settings || {};
101 pickerSettings.callback = this.openFileWithURI.bind(this); 101 //adding callback so that file picker can be opened after checking cloud status
102 pickerSettings.pickerMode = "read"; 102 this.application.ninja.coreIoApi.cloudAvailable(function(){
103 pickerSettings.inFileMode = true; 103 pickerSettings.callback = this.openFileWithURI.bind(this);
104 this.application.ninja.filePickerController.showFilePicker(pickerSettings); 104 pickerSettings.pickerMode = "read";
105 pickerSettings.inFileMode = true;
106 this.application.ninja.filePickerController.showFilePicker(pickerSettings);
107 }.bind(this));
108
105 } 109 }
106 }, 110 },
107 111
108 handleExecuteNewFile: { 112 handleExecuteNewFile: {
109 value: function(event) { 113 value: function(event) {
110 var newFileSettings = event._event.settings || {}; 114 var newFileSettings = event._event.settings || {};
111 newFileSettings.callback = this.createNewFile.bind(this); 115 //adding callback so that new file dialog can be opened after checking cloud status
112 this.application.ninja.newFileController.showNewFileDialog(newFileSettings); 116 this.application.ninja.coreIoApi.cloudAvailable(function(){
117 newFileSettings.callback = this.createNewFile.bind(this);
118 this.application.ninja.newFileController.showNewFileDialog(newFileSettings);
119 }.bind(this));
120
113 } 121 }
114 }, 122 },
115 123