Skip to content

Commit 1b24054

Browse files
maebealeclaude
andcommitted
Show staff cards' primary sector first with the starred chip
Event staff cards listed sectors as plain compact badges with no primary distinction. Use the shared tagging_label chip — primary first, starred and darker — so the staff cards match the recipients page and the rest of the app. Also realign the people "Other" response spec with the profile's single combined Sectors list (the two-column layout is gone): assert the Other answer renders as a free-text "(other)" chip rather than the starred primary, instead of keying off the removed "Additional sectors" heading. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 44949ce commit 1b24054

2 files changed

Lines changed: 13 additions & 10 deletions

File tree

app/views/events/staff.html.erb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@
2828
<% active_affiliation = person.affiliations.find { |a| !a.inactive? } %>
2929
<% org = active_affiliation&.organization %>
3030
<% bio = event_staff.public_bio %>
31-
<% sectors = person.profile_show_sectors? ? person.sectors.sort_by(&:name) : [] %>
31+
<%# Primary sector first (starred, darker chip), then the rest alphabetically —
32+
the same treatment as the recipients page. %>
33+
<% sector_items = person.profile_show_sectors? ? person.sectorable_items.includes(:sector).sort_by { |si| [ si.is_primary? ? 0 : 1, si.sector&.name.to_s.downcase ] } : [] %>
3234
<%# Facilitator tenure → one experience badge, computed from already-loaded
3335
affiliations (avoids the decorator's query-heavy badges call). Thresholds
3436
match PersonDecorator#compute_badges. %>
@@ -93,13 +95,13 @@
9395
</span>
9496
<% end %>
9597

96-
<% if sectors.any? %>
98+
<% if sector_items.any? %>
9799
<div class="mt-1.5 flex flex-wrap justify-center gap-1">
98-
<% sectors.first(3).each do |sector| %>
99-
<span class="px-2 py-0.5 rounded-md text-xs font-medium <%= DomainTheme.bg_class_for(:sectors, intensity: 100) %> <%= DomainTheme.text_class_for(:sectors, intensity: 700) %>"><%= sector.name %></span>
100+
<% sector_items.first(3).each do |si| %>
101+
<%= render "sectors/tagging_label", sector: si.sector, is_primary: si.is_primary? %>
100102
<% end %>
101-
<% if sectors.size > 3 %>
102-
<span class="px-2 py-0.5 rounded-md text-xs font-medium text-gray-400">+<%= sectors.size - 3 %></span>
103+
<% if sector_items.size > 3 %>
104+
<span class="px-2 py-0.5 rounded-md text-xs font-medium text-gray-400">+<%= sector_items.size - 3 %></span>
103105
<% end %>
104106
</div>
105107
<% end %>

spec/requests/people_other_responses_spec.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,17 @@ def answer(identifier, value)
1414
before { sign_in admin }
1515

1616
describe "profile page" do
17-
it "shows the Other service area as an additional sector" do
17+
it "shows the Other service area as a free-text chip, not the primary sector" do
1818
person.update!(profile_show_sectors: true)
1919
answer("primary_service_area", "Other: Equine therapy")
2020

2121
get person_path(person)
2222

2323
expect(response.body).to include("Equine therapy")
24-
# The Other chip sits in the "Additional sectors" column, not "Primary sector".
25-
additional_section = response.body.split("Additional sectors").last
26-
expect(additional_section).to include("Equine therapy")
24+
# The combined Sectors list renders it via the free-text "(other)" chip rather
25+
# than promoting it to the starred primary sector.
26+
equine_chip = response.body[/Equine therapy.{0,80}/m]
27+
expect(equine_chip).to include("(other)")
2728
end
2829
end
2930

0 commit comments

Comments
 (0)