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/js/filelist.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/js/filelist.js')
-rw-r--r-- | apps/files/js/filelist.js | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index e1cbfc38566..52d4c8ba3fe 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -125,7 +125,7 @@ this.$container = options.scrollContainer || $(window); this.$table = $el.find('table:first'); this.$fileList = $el.find('#fileList'); - this.fileActions = OCA.Files.FileActions; + this._initFileActions(options.fileActions); this.files = []; this._selectedFiles = {}; this._selectionSummary = new OCA.Files.FileSummary(); @@ -168,6 +168,14 @@ this.$container.on('scroll', _.bind(this._onScroll, this)); }, + _initFileActions: function(fileActions) { + this.fileActions = fileActions; + if (!this.fileActions) { + this.fileActions = new OCA.Files.FileActions(); + this.fileActions.registerDefaultActions(); + } + }, + /** * Event handler for when the URL changed */ @@ -248,6 +256,8 @@ var action = this.fileActions.getDefault(mime,type, permissions); if (action) { event.preventDefault(); + // also set on global object for legacy apps + window.FileActions.currentFile = this.fileActions.currentFile; action(filename, { $file: $tr, fileList: this, @@ -792,15 +802,6 @@ }, /** - * Sets the file actions handler. - * - * @param fileActions FileActions handler - */ - setFileActions: function(fileActions) { - this.fileActions = fileActions; - }, - - /** * Sets the current directory name and updates the breadcrumb. * @param targetDir directory to display * @param changeUrl true to also update the URL, false otherwise (default) |