diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-05-20 16:01:34 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-05-30 10:06:29 +0200 |
commit | ef59c69dc822c9ff69c564c41e0dfdce142b9cdf (patch) | |
tree | a99667ab22daba65cbbd77ac591fccac234f06eb /apps/files_trashbin/js | |
parent | fa32243d84e1801c379a5e8956ba2f3de236c718 (diff) | |
download | nextcloud-server-ef59c69dc822c9ff69c564c41e0dfdce142b9cdf.tar.gz nextcloud-server-ef59c69dc822c9ff69c564c41e0dfdce142b9cdf.zip |
Distinguish legacy file actions from regular file actions
Legacy file actions are registered by legacy apps through
window.FileActions.register(). These actions can only be used by the
main file list ("all files") because legacy apps can only deal with a
single list / container.
New file actions of compatible apps must be registered through
OCA.Files.fileActions. These will be used for other lists like the
sharing overview.
Fixed versions and sharing actions to use OCA.Files.fileActions, which
makes them available in the sharing overview list.
Diffstat (limited to 'apps/files_trashbin/js')
-rw-r--r-- | apps/files_trashbin/js/app.js | 18 | ||||
-rw-r--r-- | apps/files_trashbin/js/filelist.js | 4 |
2 files changed, 10 insertions, 12 deletions
diff --git a/apps/files_trashbin/js/app.js b/apps/files_trashbin/js/app.js index cf3fb1d0d16..c59a132b8c4 100644 --- a/apps/files_trashbin/js/app.js +++ b/apps/files_trashbin/js/app.js @@ -19,22 +19,20 @@ OCA.Trashbin.App = { this._initialized = true; this.fileList = new OCA.Trashbin.FileList( $('#app-content-trashbin'), { - scrollContainer: $('#app-content') + scrollContainer: $('#app-content'), + fileActions: this._createFileActions() } ); - this.registerFileActions(this.fileList); }, - registerFileActions: function(fileList) { - var self = this; - var fileActions = _.extend({}, OCA.Files.FileActions); - fileActions.clear(); - fileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename) { - var dir = fileList.getCurrentDirectory(); + _createFileActions: function() { + var fileActions = new OCA.Files.FileActions(); + fileActions.register('dir', 'Open', OC.PERMISSION_READ, '', function (filename, context) { + var dir = context.fileList.getCurrentDirectory(); if (dir !== '/') { dir = dir + '/'; } - fileList.changeDirectory(dir + filename); + context.fileList.changeDirectory(dir + filename); }); fileActions.setDefault('dir', 'Open'); @@ -69,7 +67,7 @@ OCA.Trashbin.App = { _.bind(fileList._removeCallback, fileList) ); }); - fileList.setFileActions(fileActions); + return fileActions; } }; diff --git a/apps/files_trashbin/js/filelist.js b/apps/files_trashbin/js/filelist.js index 205f879f335..826c1bd64d5 100644 --- a/apps/files_trashbin/js/filelist.js +++ b/apps/files_trashbin/js/filelist.js @@ -26,8 +26,8 @@ return name; } - var FileList = function($el) { - this.initialize($el); + var FileList = function($el, options) { + this.initialize($el, options); }; FileList.prototype = _.extend({}, OCA.Files.FileList.prototype, { id: 'trashbin', |