summaryrefslogtreecommitdiffstats
path: root/apps/files/js/filelist.js
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r--apps/files/js/filelist.js22
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)