-
Notifications
You must be signed in to change notification settings - Fork 24
WAIT: Add associated records links to person edit #1889
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <% return unless person.persisted? %> | ||
| <% email = person.preferred_email %> | ||
| <% notifications = email.present? ? Notification.email(email) : Notification.none %> | ||
| <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> | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
| <li><%= index_button(person.user&.workshop_logs || WorkshopLog.none, path: workshop_logs_person_path(person)) %></li> | ||
| <li><%= index_button person.scholarships, params: { recipient_id: person.id } %></li> | ||
| <li><%= index_button notifications, params: { email: email } %></li> | ||
| </ul> | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| require "rails_helper" | ||
|
|
||
| RSpec.describe "Person edit associated records", type: :request do | ||
| let(:admin) { create(:user, :admin) } | ||
|
|
||
| before { sign_in admin } | ||
|
|
||
| describe "GET /people/:id/edit" do | ||
| it "links to the person's filtered registrations, workshop logs, scholarships, and notifications" do | ||
| person = create(:person) | ||
| create(:event_registration, registrant: person) | ||
| create(:workshop_log, created_by: person.user) | ||
| create(:scholarship, recipient: person) | ||
| create(:notification, recipient_email: person.preferred_email) | ||
|
|
||
| get edit_person_path(person) | ||
|
|
||
| expect(response).to have_http_status(:ok) | ||
| expect(response.body).to include("Associated records") | ||
| expect(response.body).to include(event_registrations_path(registrant_id: person.id)) | ||
| expect(response.body).to include(workshop_logs_person_path(person)) | ||
| expect(response.body).to include(scholarships_path(recipient_id: person.id)) | ||
| expect(response.body).to include(notifications_path(email: person.preferred_email)) | ||
| end | ||
| end | ||
| end |
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.
π€ From Claude: The scholarships index previously only grouped by funder with no per-recipient view, so this adds a
recipient_idfilter (applied before grouping) so the person-edit card lands on just that person's awards.