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

[Admin] Enhance ui/table component with clickable rows and URL navigation #5397

Merged
merged 2 commits into from
Oct 13, 2023

Conversation

rainerdema
Copy link
Contributor

@rainerdema rainerdema commented Sep 29, 2023

Summary

Previously, the ui/table component would not register clicks on the whole line due to nested anchor elements within the table data cells.

  • Entire row clickability: Ensured that the entire row within the ui/table component is clickable.
  • Dynamic row URL assignment: Introduced a row_url proc to dynamically allocate URLs to rows.
Admin.Enhance.ui.table.component.with.clickable.rows.and.URL.navigation.mov

Checklist

Check out our PR guidelines for more details.

The following are mandatory for all PRs:

The following are not always needed:

  • 📖 I have updated the README to account for my changes.
  • 📑 I have documented new code with YARD.
  • 🛣️ I have opened a PR to update the guides.
  • ✅ I have added automated tests to cover my changes.
  • 📸 I have attached screenshots to demo visual changes.

@rainerdema rainerdema force-pushed the rainerd/fix/ui-table-row-click-bug branch from 1fa447c to 6a92414 Compare September 29, 2023 10:24
@rainerdema rainerdema marked this pull request as ready for review September 29, 2023 10:36
@rainerdema rainerdema requested a review from a team as a code owner September 29, 2023 10:36
@rainerdema rainerdema force-pushed the rainerd/fix/ui-table-row-click-bug branch from 6a92414 to 78e51c2 Compare September 29, 2023 10:38
@rainerdema rainerdema changed the base branch from nebulab/admin to main September 29, 2023 13:25
@rainerdema rainerdema force-pushed the rainerd/fix/ui-table-row-click-bug branch from 78e51c2 to 7086186 Compare October 10, 2023 16:54
@rainerdema rainerdema marked this pull request as draft October 11, 2023 15:13
@rainerdema rainerdema force-pushed the rainerd/fix/ui-table-row-click-bug branch from 7086186 to 97b8982 Compare October 12, 2023 11:33
@rainerdema rainerdema changed the title [Admin] ui/table component rows should accept clicks on the whole line [Admin] Enhance ui/table component with clickable rows and URL navigation Oct 12, 2023
@rainerdema rainerdema force-pushed the rainerd/fix/ui-table-row-click-bug branch from 97b8982 to 35c76d3 Compare October 12, 2023 11:46
@rainerdema rainerdema marked this pull request as ready for review October 12, 2023 11:56
@rainerdema rainerdema requested review from elia and removed request for elia October 12, 2023 11:56
Previously, the ui/table component would not register clicks on the
whole line due to nested anchor elements within the table data cells.
This commit fixes the click behavior to ensure the entire row is clickable.
This commit introduces the capability of navigational rows within
the `ui/table` component through the addition of a `row_url` proc.
The `fade_row_proc` parameter is renamed to `row_fade` to maintain a consistent
naming style throughout the component.

The `row_url` proc accepts a row object as a parameter and returns a URL string.
This URL is utilized to redirect the user when a particular row is clicked.
However, this navigation is deliberately disabled in "batch" mode to maintain the
row selection in that mode.

Example of usage:
```ruby
  row_url: ->(order) { spree.edit_admin_order_path(order) }
```
@rainerdema rainerdema force-pushed the rainerd/fix/ui-table-row-click-bug branch from 35c76d3 to 00cb97a Compare October 12, 2023 14:01
@rainerdema rainerdema requested a review from elia October 12, 2023 14:01
Copy link
Member

@elia elia left a comment

Choose a reason for hiding this comment

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

👍 🐭

@rainerdema rainerdema merged commit ee3277d into solidusio:main Oct 13, 2023
9 checks passed
@rainerdema rainerdema deleted the rainerd/fix/ui-table-row-click-bug branch October 13, 2023 08:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants