Merged
Conversation
Raudius
reviewed
Nov 30, 2022
juliusknorr
reviewed
Dec 5, 2022
This comment was marked as off-topic.
This comment was marked as off-topic.
juliusknorr
requested changes
Dec 8, 2022
Member
juliusknorr
left a comment
There was a problem hiding this comment.
There is one more thing that I haven't thought of upfront that would be that we don't need an input for the folder description. The new file action should trigger directly on click.
Something like this seems to do the trick there:
diff --git a/apps/files/js/newfilemenu.js b/apps/files/js/newfilemenu.js
index e38801ac6b4..1d618a1a8c6 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();
+ }
}
},
@@ -204,7 +212,8 @@
fileType: actionSpec.fileType,
actionHandler: actionSpec.actionHandler,
checkFilename: actionSpec.checkFilename,
- shouldShow: actionSpec.shouldShow || (() => true)
+ shouldShow: actionSpec.shouldShow,
+ useInput: actionSpec.useInput,
});
},449d2ad to
5b4d896
Compare
9b234d7 to
ead4d98
Compare
juliusknorr
approved these changes
Dec 22, 2022
ead4d98 to
73375c7
Compare
max-nextcloud
requested changes
Jan 19, 2023
Contributor
max-nextcloud
left a comment
There was a problem hiding this comment.
All in all looks good. Just one confusion with the shouldShow parameter.
Signed-off-by: Luka Trovic <luka@nextcloud.com>
73375c7 to
cacffec
Compare
max-nextcloud
approved these changes
Jan 31, 2023
Contributor
max-nextcloud
left a comment
There was a problem hiding this comment.
Nice to see this finalized.
I still disagree about the way shouldShow is handled. But there's no point in arguing about this forever.
Member
|
Failures unrelated. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
With the new flow to create rich workspace Readme files described in nextcloud/text#3209 we need a hook to be able to show or hide the entry in the new files menu depending on the current folder. For that reason this PR adds a callback that can be provided to show/hide when the menu is shown.
Required for nextcloud/text#3291
Checklist