-
Notifications
You must be signed in to change notification settings - Fork 64
Display item actions on show view #1673
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR enables item actions to be displayed on the show view, allowing users to perform actions on individual items from the detail page. The implementation refactors existing item action logic into shared functions to maintain consistency between index and show views.
- Adds item action support to the show view with modal confirmation support
- Extracts common item action handling logic into reusable
Backpex.ItemActionfunctions - Creates a new
Backpex.HTML.ItemActioncomponent for the action confirmation modal
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| lib/backpex/live_resource/show.ex | Adds item action handling to show view including action assignment, event handlers, and navigation logic |
| lib/backpex/live_resource/index.ex | Refactors to use shared item action functions from Backpex.ItemAction module |
| lib/backpex/item_actions/item_action.ex | Adds shared handle_item_action and assign_action_changeset functions for reuse across views |
| lib/backpex/live_components/form_component.ex | Renames handle_item_action to handle_form_item_action to avoid naming conflicts and changes navigation method |
| lib/backpex/html/item_action.ex | New component module providing the reusable action confirmation modal |
| lib/backpex/html/resource/resource_show.html.heex | Includes the action confirmation modal in the show view template |
| lib/backpex/html/resource/resource_index_table.html.heex | Updates to use the new filter_item_actions function for consistency |
| lib/backpex/html/resource/resource_index.html.heex | Extracts action modal into reusable component |
| lib/backpex/html/resource.ex | Refactors item action filtering into a single public filter_item_actions function and updates visibility check to public action_visible? |
| lib/backpex/live_resource.ex | Updates show page title template to render item actions as buttons |
| guides/actions/item-actions.md | Documents the new :show placement option and fixes grammar |
| demo/lib/demo_web/live/tag_live.ex | Adds :show to duplicate action visibility configuration as a demo |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
After using the edit action I would have expected to return to the show view after "save" (and especially after "go back"). Could we maybe add that via the return_to functionality? |
a4bb784 to
ddcbb9e
Compare
This is also broken on (I've added some tests for item actions in this PR to make sure they work and redirect as expected) |
|
I've added a bunch of additional tests. |
pehbehbeh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 👍 👍
depends on #1688