Skip to content

Add optional view link to InlineCRUD field rows#1856

Merged
Flo0807 merged 1 commit intodevelopfrom
feature/inline-crud-view-link
Mar 11, 2026
Merged

Add optional view link to InlineCRUD field rows#1856
Flo0807 merged 1 commit intodevelopfrom
feature/inline-crud-view-link

Conversation

@Flo0807
Copy link
Copy Markdown
Collaborator

@Flo0807 Flo0807 commented Mar 6, 2026

closes #1857

When a live_resource option is provided on an InlineCRUD field, each row in the read-only table view gets an eye icon link that navigates to the associated resource's show page. This mirrors the existing pattern used by BelongsTo and HasMany fields.

The link includes a tooltip and respects authorization via can?/3. When live_resource is not set, no action column is rendered, keeping the feature fully backwards-compatible.

image

When a live_resource option is provided on an InlineCRUD field, each row
in the read-only table view gets an eye icon link that navigates to the
associated resource's show page. This mirrors the existing pattern used
by BelongsTo and HasMany fields.

The link includes a tooltip and respects authorization via can?/3.
When live_resource is not set, no action column is rendered, keeping
the feature fully backwards-compatible.
@Flo0807 Flo0807 self-assigned this Mar 6, 2026
@Flo0807 Flo0807 added the feature New feature label Mar 6, 2026
@Flo0807 Flo0807 requested a review from Copilot March 6, 2026 11:14
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 adds an optional view (eye icon) link to each row in the InlineCRUD field's read-only table view. When the new live_resource configuration option is provided, an additional "Actions" column is rendered with a link navigating to the associated resource's show page, mirroring patterns used by BelongsTo and HasMany fields. The feature respects authorization via can?/3 and is fully backward-compatible.

Changes:

  • Added a new optional live_resource config option to the InlineCRUD field schema, with a get_link/2 helper that checks authorization and generates show page URLs
  • Added an "Actions" column header (with sr-only label) and eye icon link in each table row, with empty cell fallback when authorization is denied
  • Added a demo usage example in ProductLive for the short_links field

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/backpex/fields/inline_crud.ex Added live_resource config option, Router alias, actions column header, eye icon link with tooltip/aria-label in each row, and get_link/2 helper function
demo/lib/demo_web/live/product_live.ex Added live_resource: DemoWeb.ShortLinkLive to the short_links InlineCRUD field config

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Flo0807 Flo0807 requested a review from pehbehbeh March 6, 2026 12:10
Copy link
Copy Markdown
Member

@pehbehbeh pehbehbeh left a comment

Choose a reason for hiding this comment

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

LGTM

@Flo0807 Flo0807 added this pull request to the merge queue Mar 11, 2026
Merged via the queue into develop with commit 42e780e Mar 11, 2026
11 checks passed
@Flo0807 Flo0807 deleted the feature/inline-crud-view-link branch March 11, 2026 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-generate link field in InlineCRUD when LiveResource is provided

3 participants