diff options
author | Vincent Petry <PVince81@yahoo.fr> | 2015-09-28 19:31:05 +0300 |
---|---|---|
committer | Vincent Petry <PVince81@yahoo.fr> | 2015-09-28 19:31:05 +0300 |
commit | f3f9a58c8cdaa6ce23c72167ec92fdf783a97b22 (patch) | |
tree | 41da18741ec60ac7b2c42377a4962d08a81f0ba0 /js | |
parent | c454f1097b85a5d730e6310ab958aafc47c09a1a (diff) |
Update file list row after save
Diffstat (limited to 'js')
-rw-r--r-- | js/editor.js | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/js/editor.js b/js/editor.js index 97fbc02..8898106 100644 --- a/js/editor.js +++ b/js/editor.js @@ -169,10 +169,11 @@ var Files_Texteditor = { * Handles the FileAction click event */ _onEditorTrigger: function(filename, context) { - OCA.Files_Texteditor.currentContext = context; - OCA.Files_Texteditor.file.name = filename; - OCA.Files_Texteditor.file.dir = context.dir; - OCA.Files_Texteditor.loadEditor( + this.currentContext = context; + this.file.name = filename; + this.file.dir = context.dir; + this.fileInfoModel = context.fileList.getModelForFile(filename); + this.loadEditor( OCA.Files_Texteditor.$container, OCA.Files_Texteditor.file ); @@ -240,7 +241,7 @@ var Files_Texteditor = { OCA.Files.fileActions.registerAction({ name: 'Edit', mime: value, - actionHandler: _self._onEditorTrigger, + actionHandler: _.bind(_self._onEditorTrigger, _self), permissions: OC.PERMISSION_READ }); OCA.Files.fileActions.setDefault(value, 'Edit'); @@ -344,11 +345,12 @@ var Files_Texteditor = { * Binds the control events on the control bar */ bindControlBar: function() { - $('#editor_close').on('click', this._onCloseTrigger); + var self = this; + $('#editor_close').on('click', _.bind(this._onCloseTrigger, this)); $(window).resize(OCA.Files_Texteditor.setFilenameMaxLength); if(!$('html').hasClass('ie8')) { window.onpopstate = function (e) { - OCA.Files_Texteditor._onCloseTrigger(); + self._onCloseTrigger(); } } }, @@ -526,6 +528,14 @@ var Files_Texteditor = { closeEditor: function() { this.$container.html('').show(); this.unloadControlBar(); + if (this.fileInfoModel) { + this.fileInfoModel.set({ + // temp dummy, until we can do a PROPFIND + etag: this.fileInfoModel.get('id') + this.file.mtime, + mtime: this.file.mtime * 1000, + // TODO: set size if there is a way to know + }); + } document.title = this.oldTitle; }, |