From 96ed73343eadb8723ca3bc404259d054f42b181d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Calvi=C3=B1o=20S=C3=A1nchez?= Date: Thu, 21 Dec 2017 00:36:40 +0100 Subject: [PATCH] Trigger the "Details" action when clicking on an empty file row space MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Clicking on an empty space in a file row causes the details view to be shown. As it is a user initiated action on the file list now it is done by triggering the Details action instead of directly calling "_updateDetailsView"; the result is the same in both cases, but using the action is more consistent (clicking on the file name triggers the default action, and clicking on the inline actions triggers those actions) and also makes possible to use the "beforeTriggerAction" and "afterTriggerAction" listeners. Signed-off-by: Daniel Calviño Sánchez --- apps/files/js/filelist.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index fa9819b78b..7735e9357b 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() + }); + } } } },