diff options
author | Jose Antonio Marquez | 2012-02-14 11:45:57 -0800 |
---|---|---|
committer | Jose Antonio Marquez | 2012-02-14 11:45:57 -0800 |
commit | 646b269da2387582531258d14a3f2ff550617323 (patch) | |
tree | 41e3ac0983aeae883fae0bd1165de7b66de83650 /js | |
parent | a956f7919cf43424c2675cce24c5637f9064dcb3 (diff) | |
download | ninja-646b269da2387582531258d14a3f2ff550617323.tar.gz |
Cleaning up mediator
Diffstat (limited to 'js')
-rwxr-xr-x | js/controllers/document-controller.js | 16 | ||||
-rw-r--r-- | js/mediators/io-mediator.js | 13 |
2 files changed, 23 insertions, 6 deletions
diff --git a/js/controllers/document-controller.js b/js/controllers/document-controller.js index 84b994ce..7d38c600 100755 --- a/js/controllers/document-controller.js +++ b/js/controllers/document-controller.js | |||
@@ -104,16 +104,26 @@ 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(), this.clearDocumentDirtyFlag.bind(this)); | 107 | this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); |
108 | } | 108 | } |
109 | }, | 109 | }, |
110 | 110 | //////////////////////////////////////////////////////////////////// | |
111 | // | ||
112 | fileSaveResult: { | ||
113 | value: function (result) { | ||
114 | if(result.status === 204){ | ||
115 | this.clearDocumentDirtyFlag(); | ||
116 | } | ||
117 | } | ||
118 | }, | ||
119 | //////////////////////////////////////////////////////////////////// | ||
120 | |||
121 | |||
111 | clearDocumentDirtyFlag:{ | 122 | clearDocumentDirtyFlag:{ |
112 | value: function(){ | 123 | value: function(){ |
113 | this.activeDocument.dirtyFlag = false; | 124 | this.activeDocument.dirtyFlag = false; |
114 | } | 125 | } |
115 | }, | 126 | }, |
116 | //////////////////////////////////////////////////////////////////// | ||
117 | 127 | ||
118 | 128 | ||
119 | createNewFile:{ | 129 | createNewFile:{ |
diff --git a/js/mediators/io-mediator.js b/js/mediators/io-mediator.js index 95e775a0..599b7d84 100644 --- a/js/mediators/io-mediator.js +++ b/js/mediators/io-mediator.js | |||
@@ -155,9 +155,8 @@ exports.IoMediator = Montage.create(Component, { | |||
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){ | 158 | // |
159 | callback(); | 159 | if (callback) callback(save); |
160 | } | ||
161 | } | 160 | } |
162 | }, | 161 | }, |
163 | //////////////////////////////////////////////////////////////////// | 162 | //////////////////////////////////////////////////////////////////// |
@@ -170,6 +169,14 @@ exports.IoMediator = Montage.create(Component, { | |||
170 | }, | 169 | }, |
171 | //////////////////////////////////////////////////////////////////// | 170 | //////////////////////////////////////////////////////////////////// |
172 | // | 171 | // |
172 | fileDelete: { | ||
173 | enumerable: false, | ||
174 | value: function (file, callback) { | ||
175 | // | ||
176 | } | ||
177 | }, | ||
178 | //////////////////////////////////////////////////////////////////// | ||
179 | // | ||
173 | parseHtmlToNinjaTemplate: { | 180 | parseHtmlToNinjaTemplate: { |
174 | enumerable: false, | 181 | enumerable: false, |
175 | value: function (html) { | 182 | value: function (html) { |