Skip to content

WAIT: Add associated records links to person edit#1889

Draft
maebeale wants to merge 2 commits into
mainfrom
maebeale/person-edit-related-records
Draft

WAIT: Add associated records links to person edit#1889
maebeale wants to merge 2 commits into
mainfrom
maebeale/person-edit-related-records

Conversation

@maebeale

@maebeale maebeale commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

🤖 PR, suggested 👤 review level: 📖 Read — light-logic: a new view partial plus a small recipient_id filter on the scholarships index

What is the goal of this PR and why is this important?

  • Mirror the organization edit page's "Associated records" section on the person edit page so admins can jump straight to a person's related records.

How did you approach the change?

  • New people/_associated_records.html.erb partial, rendered in the person form (persisted only), styled to match the org version.
  • Cards link to person-scoped destinations:
    • Event registrations — filtered index via registrant_id
    • Workshop logs — the per-person workshop_logs_person_path view
    • Scholarships — added a recipient_id filter to the scholarships index (it previously only grouped by funder with no way to scope to one person) plus a "Filtered to " banner with a Clear link
    • Notifications — reuse the existing email filter, scoped to the person's preferred_email
  • Only admins reach the person edit page (PersonPolicy#edit? == admin?), so no per-card auth guards are needed.

Anything else to add?

  • Left out grants (no donor filter on the index) and form submissions (no index view at all) — both would need new server-side filtering/views; happy to add in a follow-up if wanted.
  • Request specs cover all four links rendering and the new scholarships recipient filter.

Admins need to jump from a person's edit page to the records tied to
that person, the same way the organization edit page already links out
to its associated records. Surfaces the destinations that actually scope
to the person: their event registrations (filtered index) and workshop
logs (the per-person view).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@@ -0,0 +1,5 @@
<% return unless person.persisted? %>
<ul class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-x-6 gap-y-2">
<li><%= index_button person.event_registrations, params: { registrant_id: person.id } %></li>

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤖 From Claude: Only these two records get cards because they have person-scoped destinations: registrations filter on registrant_id, and workshop_logs_person_path is the per-person view. Scholarships/grants/form-submissions have no person-filtered index, so a card would land on an unfiltered list — omitted intentionally.

Adds two more cards to the person edit "Associated records" section.
Scholarships needed a recipient_id filter on its index (it only grouped
by funder before) so the card lands on that person's awards rather than
the full list; notifications reuse the existing email filter.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
{ grant: :donor },
{ recipient: [ { affiliations: { organization: :addresses } }, { event_registrations: :event } ] }
)
if params[:recipient_id].present?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

🤖 From Claude: The scholarships index previously only grouped by funder with no per-recipient view, so this adds a recipient_id filter (applied before grouping) so the person-edit card lands on just that person's awards.

@maebeale maebeale changed the title Add associated records links to person edit WAIT: Add associated records links to person edit Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant