aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2023-01-31 09:54:57 +0100
committerGitHub <noreply@github.com>2023-01-31 09:54:57 +0100
commit9f2495cc098178e9725db495f170c6d004cac14a (patch)
tree222d2b512bfb68aabe1355ce6b0b2c5d6f3d46aa
parent9035be6b81fc527a57dcbbbb424dc9a84aef832b (diff)
parentcacffecba5f54b6c218a22f3450afd3f15e4126f (diff)
downloadnextcloud-server-9f2495cc098178e9725db495f170c6d004cac14a.tar.gz
nextcloud-server-9f2495cc098178e9725db495f170c6d004cac14a.zip
Merge pull request #35474 from nextcloud/feature/rich-workspace-visibility
Update rich-workspace visibility
-rw-r--r--apps/files/js/newfilemenu.js23
1 files changed, 17 insertions, 6 deletions
diff --git a/apps/files/js/newfilemenu.js b/apps/files/js/newfilemenu.js
index 5e6eb110e20..a101eccef29 100644
--- a/apps/files/js/newfilemenu.js
+++ b/apps/files/js/newfilemenu.js
@@ -81,10 +81,18 @@
if (action === 'upload') {
OC.hideMenus();
} else {
- event.preventDefault();
- this.$el.find('.menuitem.active').removeClass('active');
- $target.addClass('active');
- this._promptFileName($target);
+ var actionItem = _.filter(this._menuItems, function(item) {
+ return item.id === action
+ }).pop();
+ if (typeof actionItem.useInput === 'undefined' || actionItem.useInput === true) {
+ event.preventDefault();
+ this.$el.find('.menuitem.active').removeClass('active');
+ $target.addClass('active');
+ this._promptFileName($target);
+ } else {
+ actionItem.actionHandler();
+ OC.hideMenus();
+ }
}
},
@@ -198,8 +206,10 @@
templateName: actionSpec.templateName,
iconClass: actionSpec.iconClass,
fileType: actionSpec.fileType,
+ useInput: actionSpec.useInput,
actionHandler: actionSpec.actionHandler,
- checkFilename: actionSpec.checkFilename
+ checkFilename: actionSpec.checkFilename,
+ shouldShow: actionSpec.shouldShow,
});
},
@@ -220,10 +230,11 @@
* Renders the menu with the currently set items
*/
render: function() {
+ const menuItems = this._menuItems.filter(item => !item.shouldShow || (item.shouldShow instanceof Function && item.shouldShow() === true))
this.$el.html(this.template({
uploadMaxHumanFileSize: 'TODO',
uploadLabel: t('files', 'Upload file'),
- items: this._menuItems
+ items: menuItems
}));
// Trigger upload action also with keyboard navigation on enter