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 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 %> 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