diff options
author | Morris Jobke <hey@morrisjobke.de> | 2017-12-22 12:31:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-22 12:31:55 +0100 |
commit | e37fa60784f94abb6715704ffcbd479c05938e3a (patch) | |
tree | 7c3b22cc9dc5aa87c0319fcea497aca0b4bcd4df /apps/files/js/filelist.js | |
parent | e40d6f6d8c54df43c302eaec7496080b42a49619 (diff) | |
parent | c059fbd409b088f65922354149f6d2fd9b5d01b3 (diff) | |
download | nextcloud-server-e37fa60784f94abb6715704ffcbd479c05938e3a.tar.gz nextcloud-server-e37fa60784f94abb6715704ffcbd479c05938e3a.zip |
Merge pull request #7591 from nextcloud/trigger-events-before-and-after-a-file-action-is-executed
Trigger events before and after a file action is executed
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r-- | apps/files/js/filelist.js | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index fa9819b78b5..7735e9357b1 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -676,8 +676,25 @@ $(event.target).closest('a').blur(); } } else { - this._updateDetailsView($tr.attr('data-file')); + // Even if there is no Details action the default event + // handler is prevented for consistency (although there + // should always be a Details action); otherwise the link + // would be downloaded by the browser when the user expected + // the details to be shown. event.preventDefault(); + var filename = $tr.attr('data-file'); + var mime = this.fileActions.getCurrentMimeType(); + var type = this.fileActions.getCurrentType(); + var permissions = this.fileActions.getCurrentPermissions(); + var action = this.fileActions.get(mime, type, permissions)['Details']; + if (action) { + action(filename, { + $file: $tr, + fileList: this, + fileActions: this.fileActions, + dir: $tr.attr('data-path') || this.getCurrentDirectory() + }); + } } } }, |