From 8f3e8fd40216af7b2ae1829447711046be07999c Mon Sep 17 00:00:00 2001 From: maebeale Date: Sun, 1 Mar 2026 05:34:54 -0500 Subject: [PATCH 1/3] Add admin styling for unpublished people and facilitator affiliation indicators on people index - Highlight unpublished people rows with admin-only blue background - Iterate over affiliations instead of organizations for per-affiliation styling - Add grey left border on non-facilitator affiliation labels to visually distinguish facilitator affiliations Co-Authored-By: Claude Opus 4.6 --- app/views/people/people_results.html.erb | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/app/views/people/people_results.html.erb b/app/views/people/people_results.html.erb index e2dcb0ba3..5c35921e7 100644 --- a/app/views/people/people_results.html.erb +++ b/app/views/people/people_results.html.erb @@ -20,7 +20,7 @@ <% @people.each do |person| %> <% cache [person, current_user.super_user?] do %> - + "> <% show_email = person.profile_show_email? || allowed_to?(:manage?, Person) %> <%= person_profile_button(person, subtitle: (person.preferred_email if show_email), data: { turbo_frame: "_top" }) %> @@ -44,18 +44,19 @@ -- <% end %> - + - <% orgs = person.affiliations.select { |affiliation| !affiliation.inactive? && (affiliation.end_date.nil? || affiliation.end_date >= Date.current) }.map(&:organization).compact.uniq %> - <% if orgs.any? %> + <% affiliations = person.affiliations.select { |a| a.organization.present? && !a.inactive? && (a.end_date.nil? || a.end_date >= Date.current) } %> + <% if affiliations.any? %>
- <% orgs.first(3).each do |org| %> - <%= link_to org.name, organization_path(org), + <% affiliations.first(3).each do |affiliation| %> + <%= link_to affiliation.organization.name, organization_path(affiliation.organization), data: { turbo_frame: "_top" }, - class: "inline-block px-3 py-1 rounded-md text-sm font-medium #{DomainTheme.bg_class_for(:organizations, intensity: 100)} #{DomainTheme.text_class_for(:organizations)} #{DomainTheme.bg_class_for(:organizations, intensity: 100, hover: true)}" %> + class: "inline-block px-3 py-1 rounded-md text-sm font-medium #{DomainTheme.bg_class_for(:organizations, intensity: 100)} #{DomainTheme.text_class_for(:organizations)} #{DomainTheme.bg_class_for(:organizations, intensity: 100, hover: true)}", + style: affiliation.facilitator? ? nil : "border-left: 4px solid #d1d5db" %> <% end %> - <% if orgs.size > 3 %> - <%= link_to "+#{orgs.size - 3}", person_path(person), + <% if affiliations.size > 3 %> + <%= link_to "+#{affiliations.size - 3}", person_path(person), data: { turbo_frame: "_top" }, class: "inline-block px-3 py-1 rounded-md text-sm font-medium text-gray-500 hover:text-gray-700" %> <% end %> From 85e8b1d17b9119eb29043605f5ef8dae802a0f2a Mon Sep 17 00:00:00 2001 From: maebeale Date: Sun, 1 Mar 2026 05:47:21 -0500 Subject: [PATCH 2/3] Disable Turbo prefetch on person and organization profile buttons Hovering these links triggered Turbo prefetch, which loaded the show page and inflated Ahoy view counts. This adds turbo_prefetch: false to both helpers, matching the pattern used on workshop, resource, and story links. Co-Authored-By: Claude Opus 4.6 --- app/helpers/organization_helper.rb | 2 +- app/helpers/person_helper.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/helpers/organization_helper.rb b/app/helpers/organization_helper.rb index f77476483..659ff0f11 100644 --- a/app/helpers/organization_helper.rb +++ b/app/helpers/organization_helper.rb @@ -15,7 +15,7 @@ def organization_profile_button(organization, truncate_at: nil, subtitle: nil, l hover_title = [ organization.name, subtitle ].compact_blank.join(" — ") link_to organization_path(organization), - data: data, + data: { turbo_prefetch: false }.merge(data), title: hover_title, class: "group relative flex items-center gap-2 w-full px-4 py-2 diff --git a/app/helpers/person_helper.rb b/app/helpers/person_helper.rb index 4f58965ff..74b6f124a 100644 --- a/app/helpers/person_helper.rb +++ b/app/helpers/person_helper.rb @@ -16,7 +16,7 @@ def person_profile_button(person, truncate_at: nil, subtitle: nil, display_name: hover_title = [ full_name, subtitle ].compact_blank.join(" — ") link_to person_path(person), - data: data, + data: { turbo_prefetch: false }.merge(data), title: hover_title, class: "group relative flex items-center gap-2 w-full px-4 py-2 From a5629ac0f4edf08962ee0ade0b028416ca2adf56 Mon Sep 17 00:00:00 2001 From: maebeale Date: Sun, 1 Mar 2026 05:47:28 -0500 Subject: [PATCH 3/3] Add composite index on reports for type and organization_id Co-Authored-By: Claude Opus 4.6 --- db/schema.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/db/schema.rb b/db/schema.rb index fc0659cb1..87bc576f9 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -814,6 +814,7 @@ t.index ["organization_id"], name: "index_reports_on_organization_id" t.index ["owner_type", "owner_id"], name: "index_reports_on_owner_type_and_owner_id" t.index ["type", "date"], name: "index_reports_on_type_and_date" + t.index ["type", "organization_id"], name: "index_reports_on_type_and_organization_id" t.index ["windows_type_id"], name: "index_reports_on_windows_type_id" t.index ["workshop_id"], name: "index_reports_on_workshop_id" end