[Pkg-owncloud-commits] [owncloud] 150/199: Improved FileActions with context
David Prévot
taffit at moszumanska.debian.org
Sun Jun 1 18:53:20 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit 279ede33af09c43e03f97458c7fa673ff2b7982a
Author: Vincent Petry <pvince81 at owncloud.com>
Date: Mon May 19 13:18:44 2014 +0200
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.
---
apps/files/js/fileactions.js | 13 +++++++++++--
apps/files/js/filelist.js | 8 ++++++--
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js
index 085195e..9e4aeb2 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) {
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 7887bdc..08f640f 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -248,7 +248,11 @@
var action = this.fileActions.getDefault(mime,type, permissions);
if (action) {
event.preventDefault();
- action(filename);
+ action(filename, {
+ $file: $tr,
+ fileList: this,
+ fileActions: this.fileActions
+ });
}
}
}
@@ -725,7 +729,7 @@
}
// display actions
- this.fileActions.display(filenameTd, false);
+ this.fileActions.display(filenameTd, false, this);
if (fileData.isPreviewAvailable) {
// lazy load / newly inserted td ?
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list