From 646b269da2387582531258d14a3f2ff550617323 Mon Sep 17 00:00:00 2001 From: Jose Antonio Marquez Date: Tue, 14 Feb 2012 11:45:57 -0800 Subject: Cleaning up mediator --- js/controllers/document-controller.js | 16 +++++++++++++--- js/mediators/io-mediator.js | 13 ++++++++++--- 2 files changed, 23 insertions(+), 6 deletions(-) (limited to 'js') 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, { handleExecuteSave: { value: function(event) { //Text and HTML document classes should return the same save object for fileSave - this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.clearDocumentDirtyFlag.bind(this)); + this.application.ninja.ioMediator.fileSave(this.activeDocument.save(), this.fileSaveResult.bind(this)); } }, - + //////////////////////////////////////////////////////////////////// + // + fileSaveResult: { + value: function (result) { + if(result.status === 204){ + this.clearDocumentDirtyFlag(); + } + } + }, + //////////////////////////////////////////////////////////////////// + + clearDocumentDirtyFlag:{ value: function(){ this.activeDocument.dirtyFlag = false; } }, - //////////////////////////////////////////////////////////////////// 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, { } // save = this.fio.saveFile({uri: file.document.uri, contents: contents}); - if(save.status === 204){ - callback(); - } + // + if (callback) callback(save); } }, //////////////////////////////////////////////////////////////////// @@ -170,6 +169,14 @@ exports.IoMediator = Montage.create(Component, { }, //////////////////////////////////////////////////////////////////// // + fileDelete: { + enumerable: false, + value: function (file, callback) { + // + } + }, + //////////////////////////////////////////////////////////////////// + // parseHtmlToNinjaTemplate: { enumerable: false, value: function (html) { -- cgit v1.2.3