diff options
author | Morris Jobke <hey@morrisjobke.de> | 2014-06-27 15:03:21 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2014-06-27 15:03:21 +0200 |
commit | 3b2fd5e4e6aad769f656c473f1a1fe53f5936c47 (patch) | |
tree | 5e75f4c443c3590f2086b2088f2e0c623ca547a1 /apps/files/js/filelist.js | |
parent | b975f0e7184f769d9bc857c1e6db90006b45e2c8 (diff) | |
parent | 586b3a9683421181b7cd66aff2d3fabd0f34531e (diff) | |
download | nextcloud-server-3b2fd5e4e6aad769f656c473f1a1fe53f5936c47.tar.gz nextcloud-server-3b2fd5e4e6aad769f656c473f1a1fe53f5936c47.zip |
Merge pull request #9254 from owncloud/fileactions-deferred
Sync file list with file actions
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r-- | apps/files/js/filelist.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 31c4c111832..dd77b534f51 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -167,12 +167,22 @@ this.$container.on('scroll', _.bind(this._onScroll, this)); }, + /** + * Destroy / uninitialize this instance. + */ + destroy: function() { + // TODO: also unregister other event handlers + this.fileActions.removeUpdateListener(this._onFileActionsUpdated); + }, + _initFileActions: function(fileActions) { this.fileActions = fileActions; if (!this.fileActions) { this.fileActions = new OCA.Files.FileActions(); this.fileActions.registerDefaultActions(); } + this._onFileActionsUpdated = _.debounce(_.bind(this._onFileActionsUpdated, this), 100); + this.fileActions.addUpdateListener(this._onFileActionsUpdated); }, /** @@ -503,6 +513,18 @@ }, /** + * Event handler for when file actions were updated. + * This will refresh the file actions on the list. + */ + _onFileActionsUpdated: function() { + console.log('onFileActionsUpdated'); + var self = this; + this.$fileList.find('tr td.filename').each(function() { + self.fileActions.display($(this), true, self); + }); + }, + + /** * Sets the files to be displayed in the list. * This operation will re-render the list and update the summary. * @param filesArray array of file data (map) |