aboutsummaryrefslogtreecommitdiff
path: root/js/controllers/document-controller.js
diff options
context:
space:
mode:
authorPushkar Joshi2012-06-05 14:55:17 -0700
committerPushkar Joshi2012-06-05 14:55:17 -0700
commitf6584f0704be628a91e3749e0607e855aeda2477 (patch)
treec7f69d015ef0d56b492904bd14b44be590389766 /js/controllers/document-controller.js
parent3293b0b730227c14bd4f7bd53c125b48f9886764 (diff)
parent783097854612a292ac1be18ff15d88343013f773 (diff)
downloadninja-f6584f0704be628a91e3749e0607e855aeda2477.tar.gz
Merge branch 'master' into pentool
Diffstat (limited to 'js/controllers/document-controller.js')
-rwxr-xr-xjs/controllers/document-controller.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index a90375af..a3ebac24 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -174,9 +174,9 @@ exports.DocumentController = Montage.create(Component, {
174 handleExecuteSaveAll: { 174 handleExecuteSaveAll: {
175 value: function(event) { 175 value: function(event) {
176 // 176 //
177 if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ 177 if((typeof this.currentDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){
178 // 178 //
179 this.activeDocument.model.saveAll(); 179 this.currentDocument.model.saveAll();
180 } else { 180 } else {
181 //TODO: Add error handling 181 //TODO: Add error handling
182 } 182 }
@@ -186,9 +186,9 @@ exports.DocumentController = Montage.create(Component, {
186 handleExecuteSaveAs: { 186 handleExecuteSaveAs: {
187 value: function(event) { 187 value: function(event) {
188 var saveAsSettings = event._event.settings || {}; 188 var saveAsSettings = event._event.settings || {};
189 if((typeof this.activeDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){ 189 if((typeof this.currentDocument !== "undefined") && this.application.ninja.coreIoApi.cloudAvailable()){
190 saveAsSettings.fileName = this.activeDocument.model.file.name; 190 saveAsSettings.fileName = this.currentDocument.model.file.name;
191 saveAsSettings.folderUri = this.activeDocument.model.file.uri.substring(0, this.activeDocument.model.file.uri.lastIndexOf("/")); 191 saveAsSettings.folderUri = this.currentDocument.model.file.uri.substring(0, this.currentDocument.model.file.uri.lastIndexOf("/"));
192 saveAsSettings.callback = this.saveAsCallback.bind(this); 192 saveAsSettings.callback = this.saveAsCallback.bind(this);
193 this.application.ninja.newFileController.showSaveAsDialog(saveAsSettings); 193 this.application.ninja.newFileController.showSaveAsDialog(saveAsSettings);
194 } 194 }
@@ -204,9 +204,9 @@ exports.DocumentController = Montage.create(Component, {
204 //TODO: Is this used, should be cleaned up 204 //TODO: Is this used, should be cleaned up
205 handleExecuteFileCloseAll:{ 205 handleExecuteFileCloseAll:{
206 value: function(event) { 206 value: function(event) {
207 if(this.activeDocument && this.application.ninja.coreIoApi.cloudAvailable()){ 207 if(this.currentDocument && this.application.ninja.coreIoApi.cloudAvailable()){
208 while(this._documents.length > 0){ 208 while(this.currentDocument.length > 0){
209 this.closeDocument(this._documents[this._documents.length -1].uuid); 209 this.closeDocument(this.currentDocument[this.currentDocument.length -1].uuid);
210 } 210 }
211 } 211 }
212 } 212 }
@@ -291,19 +291,19 @@ exports.DocumentController = Montage.create(Component, {
291 value:function(saveAsDetails){ 291 value:function(saveAsDetails){
292 var fileUri = null, filename = saveAsDetails.filename, destination = saveAsDetails.destination; 292 var fileUri = null, filename = saveAsDetails.filename, destination = saveAsDetails.destination;
293 //update document metadata 293 //update document metadata
294 this.activeDocument.name = ""+filename; 294 this.currentDocument.model.file.name = ""+filename;
295 //prepare new file uri 295 //prepare new file uri
296 if(destination && (destination.charAt(destination.length -1) !== "/")){ 296 if(destination && (destination.charAt(destination.length -1) !== "/")){
297 destination = destination + "/"; 297 destination = destination + "/";
298 } 298 }
299 fileUri = destination+filename; 299 fileUri = destination+filename;
300 300
301 this.activeDocument.uri = fileUri; 301 this.currentDocument.model.file.uri = fileUri;
302 //save a new file 302 //save a new file
303 //use the ioMediator.fileSaveAll when implemented 303 //use the ioMediator.fileSaveAll when implemented
304 this.activeDocument.model.file.name = filename; 304 this.currentDocument.model.file.name = filename;
305 this.activeDocument.model.file.uri = fileUri; 305 this.currentDocument.model.file.uri = fileUri;
306 this.activeDocument.model.save(); 306 this.currentDocument.model.save();
307 } 307 }
308 }, 308 },
309 309