aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorJose Antonio Marquez2012-02-13 22:43:48 -0800
committerJose Antonio Marquez2012-02-13 22:43:48 -0800
commitef5142d5426309bca6b4ef0aeee437e3ebe838fc (patch)
tree937245a734a3eef972187dc8fdd1d01ecde64f42 /js
parent5b6c62b7164cbde2845a3f7af810568e5ba53a6a (diff)
parent91822817e23f43aa61e901867369a33d7db1964c (diff)
downloadninja-ef5142d5426309bca6b4ef0aeee437e3ebe838fc.tar.gz
Merge branch 'refs/heads/AnanyaFileIO' into FileIO
Diffstat (limited to 'js')
-rwxr-xr-xjs/controllers/document-controller.js13
-rw-r--r--js/mediators/io-mediator.js5
2 files changed, 15 insertions, 3 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js
index 21445214..84b994ce 100755
--- a/js/controllers/document-controller.js
+++ b/js/controllers/document-controller.js
@@ -104,9 +104,15 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
104 handleExecuteSave: { 104 handleExecuteSave: {
105 value: function(event) { 105 value: function(event) {
106 //Text and HTML document classes should return the same save object for fileSave 106 //Text and HTML document classes should return the same save object for fileSave
107 this.application.ninja.ioMediator.fileSave(this.activeDocument.save()); 107 this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.clearDocumentDirtyFlag.bind(this));
108 } 108 }
109 }, 109 },
110
111 clearDocumentDirtyFlag:{
112 value: function(){
113 this.activeDocument.dirtyFlag = false;
114 }
115 },
110 //////////////////////////////////////////////////////////////////// 116 ////////////////////////////////////////////////////////////////////
111 117
112 118
@@ -135,8 +141,11 @@ DocumentController = exports.DocumentController = Montage.create(Component, {
135 openNewFileCallback:{ 141 openNewFileCallback:{
136 value:function(doc){ 142 value:function(doc){
137 var response = doc || null;//default just for testing 143 var response = doc || null;//default just for testing
138 if(!!response && response.success && !!response.uri){ 144 if(!!response && response.success && (response.status!== 500) && !!response.uri){
139 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this)); 145 this.application.ninja.ioMediator.fileOpen(response.uri, this.openFileCallback.bind(this));
146 }else if(!!response && !response.success){
147 //Todo: restrict directory path to the sandbox, in the dialog itself
148 alert("Unable to create file.\n [Error: Forbidden directory]");
140 } 149 }
141 } 150 }
142 }, 151 },
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js
index 47069cfb..95e775a0 100644
--- a/js/mediators/io-mediator.js
+++ b/js/mediators/io-mediator.js
@@ -154,7 +154,10 @@ exports.IoMediator = Montage.create(Component, {
154 break; 154 break;
155 } 155 }
156 // 156 //
157 save = this.fio.saveFile({uri: file.document.uri, contents: contents}) 157 save = this.fio.saveFile({uri: file.document.uri, contents: contents});
158 if(save.status === 204){
159 callback();
160 }
158 } 161 }
159 }, 162 },
160 //////////////////////////////////////////////////////////////////// 163 ////////////////////////////////////////////////////////////////////