diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-05-19 13:18:44 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-05-30 10:06:29 +0200 |
commit | 279ede33af09c43e03f97458c7fa673ff2b7982a (patch) | |
tree | ef6ef82581ef7d2bdaa093b4aa083e7926b8ef8a /apps/files/js/fileactions.js | |
parent | 9baf47c2b457e497914e6ecfe96efb7d92530079 (diff) | |
download | nextcloud-server-279ede33af09c43e03f97458c7fa673ff2b7982a.tar.gz nextcloud-server-279ede33af09c43e03f97458c7fa673ff2b7982a.zip |
Improved FileActions with context
A context hash is now passed to file action handlers which makes it
possible to have file list specific file actions.
Diffstat (limited to 'apps/files/js/fileactions.js')
-rw-r--r-- | apps/files/js/fileactions.js | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 085195e961d..9e4aeb2f338 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -98,8 +98,13 @@ * @param parent "td" element of the file for which to display actions * @param triggerEvent if true, triggers the fileActionsReady on the file * list afterwards (false by default) + * @param fileList OCA.Files.FileList instance on which the action is + * done, defaults to OCA.Files.App.fileList */ - display: function (parent, triggerEvent) { + display: function (parent, triggerEvent, fileList) { + if (!fileList) { + console.warn('FileActions.display() MUST be called with a OCA.Files.FileList instance'); + } this.currentFile = parent; var self = this; var actions = this.getActions(this.getCurrentMimeType(), this.getCurrentType(), this.getCurrentPermissions()); @@ -122,7 +127,11 @@ self.currentFile = event.data.elem; var file = self.getCurrentFile(); - event.data.actionFunc(file); + event.data.actionFunc(file, { + $file: $(this).closest('tr'), + fileList: fileList || OCA.Files.App.fileList, + fileActions: self + }); }; var addAction = function (name, action, displayName) { |