Conversation
Roles and text transform actions each hand-roll the same four move items and their Stimulus wiring, and the enumeration lists are about to become the third copy. Adds one descriptor and a thin builder so consumers keep their own menu layout, submenu or flat. https://community.openproject.org/wp/DREAM-775
Swaps the duplicated move item constants and builders in the roles table and the text transform actions list for the shared helper, so the item wiring has a single owner. The rendered menus do not change. https://community.openproject.org/wp/DREAM-775
There was a problem hiding this comment.
🟢 Approval recommended
The refactor cleanly centralizes previously duplicated move-menu wiring and includes targeted component specs to prevent regressions.
Pull request overview
This PR introduces a shared SortableLists::MoveMenu mixin to centralize the four-direction “move” action menu items used by sortable-lists UI consumers, replacing previously duplicated constants/builders while keeping rendered menus unchanged.
Changes:
- Added
SortableLists::MoveMenuwith a frozenDIRECTIONSdescriptor and a privatewith_move_items(menu)builder. - Refactored Roles row action menu and Admin text transform actions menu to use
with_move_itemsinstead of localMOVE_ITEMS/builder code. - Added a component spec verifying ordering, Stimulus wiring, labels/icons, and privacy of the builder.
File summaries
| File | Description |
|---|---|
| app/components/sortable_lists/move_menu.rb | New shared mixin defining the canonical move directions and item wiring. |
| spec/components/sortable_lists/move_menu_spec.rb | New spec covering direction order, Stimulus data, labels/icons, and API privacy. |
| app/components/roles/row_component.rb | Replaces per-component move item constant/builder with the shared mixin helper. |
| app/components/admin/text_transform_actions/row_component.rb | Removes duplicated move item builder and includes the shared mixin. |
| app/components/admin/text_transform_actions/row_component.html.erb | Switches the menu rendering to use with_move_items(menu). |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Warning Flaky specs
🤖 Ask Copilot to investigateCopy the prompt below into a new comment on this PR to delegate the investigation to GitHub Copilot. It will look into the flakiness and open a separate pull request with you as reviewer. |
|
Caution The provided work package version does not match the core version Details:
Please make sure that:
|
Ticket
https://community.openproject.org/wp/DREAM-775
What are you trying to accomplish?
First slice of DREAM-775: one shared descriptor for the four-direction move menu used by sortable-lists consumers.
The roles table and the text transform actions list each carried an identical
MOVE_ITEMSconstant and item builder. The enumeration lists (DREAM-789) would have been the third copy, so this lands first and that migration stacks on it.What approach did you choose and why?
SortableLists::MoveMenuis a mixin with a frozenDIRECTIONSdescriptor (label key, direction value, icon, Stimulus data) and one private builder,with_move_items(menu), that adds the four items to anyActionMenuor submenu.Consumers keep ownership of the surrounding menu. Roles nests the items in a "Move" submenu; text transform actions renders them flat between two dividers. A helper that also owned the submenu wrapper would have needed an escape hatch for the flat layout straight away, and for Backlogs later. A data-only constant would have left the item builder duplicated in every consumer.
Both retrofits are pure refactors: the rendered menus are unchanged.
DREAM-775 stays open. Covered here: "one descriptor defines labels, icons, direction values and Stimulus data" and "supports list rows beyond Backlogs cards". Not covered: Backlogs adoption, the project attributes retrofit, and Resource Planner (DREAM-793).
AI involvement
Merge checklist