From b082278f0404efc65b72d7cf0516d2de52f1393b Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Wed, 15 Aug 2018 09:39:12 +0200 Subject: Do not show action menu if no actions are available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- apps/files/js/fileactions.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'apps/files/js/fileactions.js') diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index 3623663ed6c..ac3afba038d 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -558,7 +558,13 @@ } }); - this._renderMenuTrigger($tr, context); + var menuActions = Object.values(this.actions.all).filter(function (action) { + return action.type !== OCA.Files.FileActions.TYPE_INLINE; + }); + // do not render the menu if nothing is in it + if (menuActions.length > 0) { + this._renderMenuTrigger($tr, context); + } if (triggerEvent){ fileList.$fileList.trigger(jQuery.Event("fileActionsReady", {fileList: fileList, $files: $tr})); -- cgit v1.2.3 From 5647f85a3cc88e8b650164d56839448abb5e0229 Mon Sep 17 00:00:00 2001 From: "John Molakvoæ (skjnldsv)" Date: Thu, 16 Aug 2018 07:43:57 +0200 Subject: Object.values polyfill MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: John Molakvoæ (skjnldsv) --- apps/files/js/fileactions.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'apps/files/js/fileactions.js') diff --git a/apps/files/js/fileactions.js b/apps/files/js/fileactions.js index ac3afba038d..8ce8eddb0b0 100644 --- a/apps/files/js/fileactions.js +++ b/apps/files/js/fileactions.js @@ -558,6 +558,20 @@ } }); + function objectValues(obj) { + var res = []; + for (var i in obj) { + if (obj.hasOwnProperty(i)) { + res.push(obj[i]); + } + } + return res; + } + // polyfill + if (!Object.values) { + Object.values = objectValues; + } + var menuActions = Object.values(this.actions.all).filter(function (action) { return action.type !== OCA.Files.FileActions.TYPE_INLINE; }); -- cgit v1.2.3