Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Allow to reorder options of "checkbox" "radio" and "dropdown" question types in frontend #2092

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

susnux
Copy link
Collaborator

@susnux susnux commented Apr 22, 2024

This adds support to reorder options instead of having to remove them.
It works but I had to modify a lot of places to keep smooth behavior of the list ordering.

Implementation things:

  • I am not sure about the API endpoint, it does not match our current naming style
  • Should we expose the "order" property or just keep it internally and only return options sorted?

@nextcloud/designers question:

  • There is not much space for a "drag" handle + a11y button so I just used buttons, I do not think it looks super awesome, but it works. Do you have an idea how to improve? Especially because there is already the drag handle for the question itself.

Screenshots

Shuffle options enabled = no sorting No shuffle = you can sort
Screenshot 2024-04-22 at 12-31-10 fff9 - Forms - Nextcloud Screenshot 2024-04-22 at 12-31-51 fff9 - Forms - Nextcloud

@susnux susnux added enhancement New feature or request 3. to review Waiting for reviews labels Apr 22, 2024
@susnux susnux added this to the 4.3 milestone Apr 22, 2024
@szaimen
Copy link

szaimen commented Apr 22, 2024

  • There is not much space for a "drag" handle + a11y button so I just used buttons, I do not think it looks super awesome, but it works. Do you have an idea how to improve? Especially because there is already the drag handle for the question itself.

I think it looks fine but had one suggestion :)

Copy link
Collaborator

@Chartman123 Chartman123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some things I found by looking at the code, did not test it by now.

appinfo/routes.php Outdated Show resolved Hide resolved
docs/API.md Outdated Show resolved Hide resolved
lib/Controller/ApiController.php Outdated Show resolved Hide resolved
src/components/Questions/AnswerInput.vue Outdated Show resolved Hide resolved
Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is not much space for a "drag" handle + a11y button so I just used buttons, I do not think it looks super awesome, but it works. Do you have an idea how to improve? Especially because there is already the drag handle for the question itself.

@susnux what about using a drag handle that on click/enter shows a menu saying "Move up" and "Move down"? Then it would be 1 icon less, and both cases would be covered.

Questions:

  • Should the drag handle be on left or right – I would tend towards left
  • Which icon to use. I’d say the simple "drag" – or we use that for the whole question, and the "drag-horizontal-variant" for the individual replies?

@Chartman123
Copy link
Collaborator

drag handle that on click/enter shows a menu saying "Move up" and "Move down"

@jancborchardt This would on the other hand introduce one more click for every move operation...

  • Should the drag handle be on left or right – I would tend towards left

having the handle on the left would introduce one more difference between edit and view mode, but we already have some differences, so I'd be fine with that. Whatever looks better as a whole.

@susnux
Copy link
Collaborator Author

susnux commented Apr 23, 2024

The problem with a drag handle on the left is the conflict with the drag handle for the question itself.
We would then have two drag handles next to each other. Not sure about that.

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
…ype options

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
@Chartman123
Copy link
Collaborator

@susnux @jancborchardt What about having the arrow icons as an overlay at the end of the input fields that only shows up when the field has the focus / hover?

@susnux should I add your backend code to the API v3 PR or would you like to keep it in here and adjust it after v3 merge?

@susnux
Copy link
Collaborator Author

susnux commented Aug 11, 2024

adjust it after v3 merge?

will adjust afterwards :)

Copy link
Member

@jancborchardt jancborchardt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about having the arrow icons as an overlay at the end of the input fields that only shows up when the field has the focus / hover?

@Chartman123 sounds good! Then it’s not that much visual noise, and the fields are nicely aligned in width. :)

@Chartman123 Chartman123 modified the milestones: 4.3, 5.0 Sep 23, 2024
@Chartman123 Chartman123 changed the title feat: Allow to reorder options of "checkbox" "radio" and "dropdown" question types feat: Allow to reorder options of "checkbox" "radio" and "dropdown" question types in frontend Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow multiple choice or checkbox answers to be reordered
4 participants