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

Move Paragraphs item action buttons to top right in a drop-down style. #62

Closed
laryn opened this issue Apr 20, 2020 · 28 comments · Fixed by #180
Closed

Move Paragraphs item action buttons to top right in a drop-down style. #62

laryn opened this issue Apr 20, 2020 · 28 comments · Fixed by #180

Comments

@laryn
Copy link
Member

laryn commented Apr 20, 2020

This issue is solely for moving the actions on a Paragraphs item into the top right in a drop-down button style (though not necessarily a literal dropdown button). The D7 issue this started from is below, but any additional aspects desired from that D7 issue would need separate issues filed.


This is an issue from the Drupal 7 queue that is marked "Needs Review" and could improve the UI.

Problem/Motivation

Basic support for collapsible paragraph items was added in #2273555: Collapsible paragraphs in node edit form, but a number of UX enhancements requested in that issue failed to make it into the committed patches and the UI could still use some refinement. To avoid confusion, I'm copying those outstanding issues here for continued development.

Proposed resolution

  1. Move all the actions available on a paragraph item (edit/collapse/remove) into a single drop button, instead of displaying them as separate buttons. This drop button can be floated right at the top of the paragraph item, saving significant space. This ticket
  2. Add links at the top of the paragraphs field to expand all/collapse all. Link at the top of the paragraphs field to expand all/collapse all #177
  3. Add an option to the drop button for each paragraph item to reset any unsaved changes. Option to reset unsaved changes on a Paragraphs item #185
  4. Add an option to completely disable collapsing items in the configuration form for paragraphs fields.

https://www.drupal.org/project/paragraphs/issues/2476253

@laryn
Copy link
Member Author

laryn commented Oct 27, 2021

During Backdrop LIVE recently @quicksketch also "thought out loud" about the new modal administration being used in the back end to eliminate the inline forms that get messy so quickly -- just display a non-editable "preview" slice of each Paragraphs item (which can be sorted) and an associated "Edit" button that loads the edit fields in a modal.

@laryn laryn added the question Further information is requested label Oct 27, 2021
@yorkshire-pudding
Copy link
Contributor

I think those suggestion would be good.

@irinaz
Copy link

irinaz commented May 28, 2024

@laryn , let me know where is good start to move forward to implement these features
wishilist for gin paragraph buttons
gin paragraph buttons in D10

@laryn
Copy link
Member Author

laryn commented May 28, 2024

@irinaz If you look where those buttons are added, you can start a branch/PR for this ticket and test out converting them to Backdrop's "dropbutton" format. Look at $element['inner_actions'] inside paragraphs_field_widget_form_build().

@irinaz
Copy link

irinaz commented May 29, 2024

@laryn , starting here

$element['inner_actions']['collapse_button'] = array(
, correct?

@herbdool
Copy link
Contributor

The hitch is that the dropbutton library was built to work with the operations form field type (which creates a list of <a>) rather than <input> with submit handlers and ajax callbacks. I'm not sure if the latter can easily be converted to <a>.

There's a fuller answer here: https://stackoverflow.com/questions/18026951/drupal-ajax-call-from-click-of-a-link-in-form

By the way, it seems like we should add operations to the Form API docs: https://docs.backdropcms.org/form_api

@herbdool
Copy link
Contributor

Maybe what could be done is rearranging some items. The buttons could be put on the same row as the paragraph type title.

2024-05-31 15 19 43 bd3 lndo site d21da130b4a2

And maybe to imitate the three dots, all the buttons other than Edit could be put into a <details> tag and then style that tag to look like the three dots.

herbdool added a commit to herbdool/paragraphs that referenced this issue May 31, 2024
@herbdool
Copy link
Contributor

Here's an incremental improvement by moving the buttons to the top right #179. I added some classes to make it easier to theme.

2024-05-31 17 28 42 bd3 lndo site adcc8bc6e9c2

In a second iteration, perhaps some fancier button dropdown could happen, though I think this already improves things for our purposes.

@irinaz
Copy link

irinaz commented May 31, 2024

@herbdool , this is terrific! Does this change include "collapse all / open all" or that should be separate change? thanks again!

@herbdool
Copy link
Contributor

@irinaz it only includes what I mentioned above. No secret features.

Expand/collapse all is unlikely to happen soon since it isn't easy to implement. Requires triggering all the ajax callbacks at once.

@irinaz
Copy link

irinaz commented May 31, 2024

Thank you for clarification and for adding new styling for buttons!!

@laryn
Copy link
Member Author

laryn commented Jun 1, 2024

Thanks @herbdool -- I took a quick look and do think this is an improvement. I'll try to review more thoroughly next week. I also looked at D10 enough to see that they're doing something similar to what you described in terms of fancy dropdown build around buttons (although not using details for it). Maybe we could pull something from their implementation.
CleanShot 2024-05-31 at 20 05 34@2x

@herbdool
Copy link
Contributor

herbdool commented Jun 1, 2024

@laryn good idea of looking how they do it. I would still use <details> since it's already built to be accessible and requires less effort but it can be styled to look like those three dots I think.

My PR is a bit of a POC. I wondered about wrapping the title and the buttons in a div as well to make it more robust.

@herbdool
Copy link
Contributor

herbdool commented Jun 4, 2024

I've got something closer to extra actions menu:

2024-06-04 14 17 57 bd3 lndo site 42e878731bac

Maybe there should be a separate issue for the buttons instead of this issue, since this one is more of a META issue. I don't feel like working on everything on this list - spent too much time on this one thing already.

#180

@klonos
Copy link
Member

klonos commented Jun 10, 2024

By the way, it seems like we should add operations to the Form API docs: https://docs.backdropcms.org/form_api

It's already there @herbdool: https://docs.backdropcms.org/form_api#operations

The hitch is that the dropbutton library was built to work with the operations form field type (which creates a list of <a>) rather than <input> with submit handlers and ajax callbacks. I'm not sure if the latter can easily be converted to <a>.

I've created this core issue to request that: backdrop/backdrop-issues#6594 ...I did my best to describe the need, but you might wanna have a look and tweak the issue title and summary, as you have more context.

@laryn
Copy link
Member Author

laryn commented Jun 25, 2024

@herbdool I like the alternate PR that makes the dropdown. I want to look into a bit of styling on Gin before I release it, and had a question for your opinion on styling for Seven. Here's the PR:
CleanShot 2024-06-24 at 22 57 24@2x

And here's my tweak for discussion, attempting to stick closer to Seven's border width for consistency. What do you think?
CleanShot 2024-06-24 at 22 54 54@2x

And just so you see what I mean, here's Gin in dark mode:
CleanShot 2024-06-24 at 22 58 24@2x

@laryn
Copy link
Member Author

laryn commented Jun 25, 2024

I'm also wondering if clicking the ... should close an open dropmenu as well.

@herbdool herbdool added the has pr Has a PR or branch for testing. label Jun 25, 2024
@herbdool herbdool changed the title Improve collapsible paragraphs Better organization of edit buttons Jun 25, 2024
@herbdool
Copy link
Contributor

herbdool commented Jun 25, 2024

@laryn I changed the css to make the border thicker.

For some reason the JS is interfering with clicking the details closed from the details summary (works when I comment the JS out). I haven't figured out yet how to make that work better.

Interesting thing is that github has the same issue - try it with the three dots on the top right of a comment.

@laryn
Copy link
Member Author

laryn commented Jun 25, 2024

Interesting thing is that github has the same issue - try it with the three dots on the top right of a comment.

@herbdool On Github, it seems like if you hover exactly over one of the three dots and they turn blue, then it will close it. That's probably not ideal. 😆

@herbdool
Copy link
Contributor

@laryn I'm a bit at a loss. Can we just say good enough for now?

@laryn
Copy link
Member Author

laryn commented Jun 25, 2024

@herbdool I'm taking a look. Did you push the CSS changes for border width?

@herbdool
Copy link
Contributor

@laryn now it's up. I forgot to push it.

@irinaz
Copy link

irinaz commented Jun 25, 2024

Works for me as is, thanks for making this work @herbdool and @laryn !

@laryn
Copy link
Member Author

laryn commented Jun 25, 2024

@herbdool I'm going to push a PR to your branch to see if you're okay with some changes:

CleanShot 2024-06-25 at 15 18 45

@laryn laryn changed the title Better organization of edit buttons Move Paragraphs item action buttons to top right in a drop-down style. Jun 25, 2024
@laryn laryn closed this as completed in bfb0dfc Jun 25, 2024
@laryn laryn removed question Further information is requested has pr Has a PR or branch for testing. labels Jun 25, 2024
@laryn
Copy link
Member Author

laryn commented Jun 25, 2024

Merged. Thank you @herbdool and @irinaz!

@irinaz
Copy link

irinaz commented Jun 25, 2024

Thank you so much, @laryn and @herbdool . Can this be a new release or I should update module manually? Thank you soooo much!!

@laryn
Copy link
Member Author

laryn commented Jun 25, 2024

@irinaz I'm not quite ready to make a release but hopefully relatively soon. In the meantime update manually or use the dev code.

@laryn
Copy link
Member Author

laryn commented Jul 12, 2024

I made some adjustments in Gin for this new UI.
CleanShot 2024-07-12 at 13 03 23

laryn added a commit to backdrop-contrib/gin that referenced this issue Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
5 participants