diff --git a/app/views/organizations/populations_served.html.erb b/app/views/organizations/populations_served.html.erb
index af7d44dbdf..186378605e 100644
--- a/app/views/organizations/populations_served.html.erb
+++ b/app/views/organizations/populations_served.html.erb
@@ -20,16 +20,14 @@
The organization's profile and list show only primary tags.
<% if show_sectors || show_age_groups %>
-
<%= render "shared/copy_url" %>
- <%# Radios inside the search form, so a change auto-submits via the collection
- controller. The default option submits blank, so the server re-derives the
- default (Title once kinds are picked) until someone picks a sort. %>
-
- Sort by
-
- <% Resource::SORT_OPTIONS.each do |label, value| %>
-
- <% end %>
-
+ <%# Blank submits for the default, so the server re-derives it (Title once kinds are picked) %>
+
diff --git a/app/views/shared/_sort_strip.html.erb b/app/views/shared/_sort_strip.html.erb
new file mode 100644
index 0000000000..af6c71bf26
--- /dev/null
+++ b/app/views/shared/_sort_strip.html.erb
@@ -0,0 +1,43 @@
+<%# The one "Sort by" control for card/list indexes (tables sort by column header instead).
+ Segments fill with the domain's 700 color when active.
+
+ Two modes:
+ - Radios (no `href`): put it inside the search form so the collection controller
+ auto-submits; the checked segment is styled with `has-checked` (no JS).
+ `default` names the value that submits blank, so the server re-derives it.
+ - Links (`href` given): the server marks the active segment.
+
+ locals:
+ options - { label => value }
+ selected - the active value
+ domain - DomainTheme key for the active fill
+ href - optional ->(value) { path } (link mode)
+ link_data - optional data attributes for each link (e.g. turbo_frame)
+ active_icon - optional Font Awesome class shown after the active link (e.g. a direction arrow)
+ default - optional radio value that submits blank %>
+<%
+ href = local_assigns[:href]
+ active_icon = local_assigns[:active_icon]
+ active_bg = DomainTheme.bg_class_for(domain, intensity: 700)
+ segment = "inline-flex items-center gap-1 rounded-md px-3 py-1 font-medium"
+%>
+
+ Sort by
+
+ <% options.each do |label, value| %>
+ <% if href %>
+ <% active = value == selected %>
+ <%# Built inline (not a block) so the link text is exactly the label %>
+ <% text = active && active_icon ? safe_join([ label, tag.i(class: "fa-solid #{active_icon} text-xs") ]) : label %>
+ <%= link_to text, href.call(value), data: local_assigns[:link_data], aria: { current: (active ? "true" : nil) },
+ class: "#{segment} #{active ? "#{active_bg} text-white" : "text-gray-600 hover:bg-gray-100"}" %>
+ <% else %>
+
+ <% end %>
+ <% end %>
+
+
diff --git a/app/views/users/users_results.html.erb b/app/views/users/users_results.html.erb
index f257d9922e..87908ac580 100644
--- a/app/views/users/users_results.html.erb
+++ b/app/views/users/users_results.html.erb
@@ -8,11 +8,11 @@
<% if @users.any? %>
-
<%= render "workshops_count" %>
<% end %>
diff --git a/db/seeds/features/2026-11-20-one-sort-by-control.yml b/db/seeds/features/2026-11-20-one-sort-by-control.yml
new file mode 100644
index 0000000000..4b45d6a2f4
--- /dev/null
+++ b/db/seeds/features/2026-11-20-one-sort-by-control.yml
@@ -0,0 +1,12 @@
+name: "One Sort by control on workshops, bookmarks, and users"
+area: content
+display_status: admin_facing
+released_on: 2026-11-20
+pr_number: 2981
+action_path: "/workshops"
+summary: >-
+ Workshops, My Bookmarks, and the users list on small screens now sort with the
+ same Sort by button strip as the resource library and an organization's
+ sectors and age groups page.
+pro_tips:
+ - "On My Bookmarks and the users list, click the highlighted option again to flip between ascending and descending; the arrow shows which way it runs."
diff --git a/docs/design/house-style.md b/docs/design/house-style.md
index 8ca5c70766..d87eae95e6 100644
--- a/docs/design/house-style.md
+++ b/docs/design/house-style.md
@@ -105,8 +105,8 @@ users index (`app/views/users/users_results.html.erb`) is the reference.
- Each card leads with the row's identity card (e.g. the person button) and its
actions on one line, then the remaining fields below, ending with a wrapping
`
` of muted label + value pairs.
-- Keep sorting on small screens: a "Sort by" bar above the cards calls the same
- `sort_header_link` generator as the table headers.
+- Keep sorting on small screens: render the **Sort by strip** (below) above the
+ cards, in link mode, with the same sort/direction params as the table headers.
- Let long unbroken values (emails, URLs) wrap with `wrap-anywhere`, plus a
`` at the natural break (before the `@`).
@@ -118,3 +118,24 @@ closed and rotating up when open. `events/_charts_toggle_bar` and
`events/_panel_cta` are the reference. A chevron leads only on a disclosure row
whose whole row is the click target (an accordion header), where it marks the
row's state before its title.
+
+## Sort by strip
+
+Card and list pages sort with one control: `shared/_sort_strip`, a "Sort by"
+label beside a segmented strip whose active segment fills with the domain's 700
+color. Tables sort by clicking column headers (`sort_header_link`) instead; a
+table's small-screen card list uses the strip.
+
+- **Radio mode** (no `href:`) — inside a search form wired to the `collection`
+ controller, so a click auto-submits; `has-checked` styles the active segment
+ with no JS. `default:` names the value that submits blank, so the server
+ re-derives the default. Workshops and resources are the reference.
+- **Link mode** (`href: ->(value) { path }`) — the server marks the active
+ segment with `aria-current`. Pass `link_data: { turbo_frame: … }` inside a
+ results frame. For a reversible sort, point the active segment's href at the
+ opposite direction and pass `active_icon:` (`fa-arrow-up` / `fa-arrow-down`).
+ My Bookmarks, the users small-screen cards, and the org sectors page are the
+ reference. Keep labels direction-neutral ("Name", not "A–Z") on a reversible sort.
+- Options are a `{ label => value }` constant beside the sort logic (e.g.
+ `WorkshopSearchService::SORT_OPTIONS`); labels are sentence case.
+- Place it at the right end of the count row (`ml-auto`) on index pages.
diff --git a/lib/domain_theme.rb b/lib/domain_theme.rb
index 9e399bdf1b..3a123f7db0 100644
--- a/lib/domain_theme.rb
+++ b/lib/domain_theme.rb
@@ -34,6 +34,7 @@ module DomainTheme
banners: :yellow,
users: :rose,
+ bookmarks: :sky,
notifications: :purple,
comments: :blue,
topic_subscriptions: :stone,
diff --git a/spec/models/resource_spec.rb b/spec/models/resource_spec.rb
index 6709db6703..1b71ca31fa 100644
--- a/spec/models/resource_spec.rb
+++ b/spec/models/resource_spec.rb
@@ -70,8 +70,9 @@
end
describe ".sorted_by" do
- let!(:older) { create(:resource, title: "Bravo", kind: "Toolkit", created_at: 2.days.ago, updated_at: 1.hour.ago) }
- let!(:newer) { create(:resource, title: "Alpha", kind: "Handout", created_at: 1.day.ago, updated_at: 2.hours.ago) }
+ # update_columns after create: the factory's after(:create) sector touches updated_at
+ let!(:older) { create(:resource, title: "Bravo", kind: "Toolkit", created_at: 2.days.ago).tap { |r| r.update_columns(updated_at: 1.hour.ago) } }
+ let!(:newer) { create(:resource, title: "Alpha", kind: "Handout", created_at: 1.day.ago).tap { |r| r.update_columns(updated_at: 2.hours.ago) } }
it "sorts by created, modified, title, and kind" do
expect(Resource.sorted_by("created")).to eq([ newer, older ])
diff --git a/spec/requests/bookmarks_spec.rb b/spec/requests/bookmarks_spec.rb
index 58f7d84b81..6c24d21ba2 100644
--- a/spec/requests/bookmarks_spec.rb
+++ b/spec/requests/bookmarks_spec.rb
@@ -117,6 +117,16 @@
expect(response).to have_http_status(:ok)
end
+ it "marks the active sort and links it to flip direction" do
+ get personal_bookmarks_path, params: { sort: "title", direction: "desc" },
+ headers: { "Turbo-Frame" => "personal_bookmarks_results" }
+
+ active = Capybara.string(response.body).find("a[aria-current='true']")
+ expect(active).to have_text("Title")
+ expect(active).to have_css("i.fa-arrow-down")
+ expect(active[:href]).to include("direction=asc")
+ end
+
it "can access personal bookmarks with keyword filter and title sort via turbo frame" do
get personal_bookmarks_path, params: { sort: "title", keyword: "test" },
headers: { "Turbo-Frame" => "personal_bookmarks_results" }
diff --git a/spec/requests/organization_sector_age_rollup_spec.rb b/spec/requests/organization_sector_age_rollup_spec.rb
index ac7ac8ac1b..f075b63c35 100644
--- a/spec/requests/organization_sector_age_rollup_spec.rb
+++ b/spec/requests/organization_sector_age_rollup_spec.rb
@@ -189,6 +189,13 @@ def rows_for(section_title)
expect(rows_for("Age groups served").keys).to eq(%w[Adults Children Teens])
end
+ it "marks the chosen sort on the sort strip" do
+ get populations_served_organization_path(harbor, sort: "total")
+
+ expect(body).to have_css("a[aria-current='true']", text: "Total")
+ expect(body).to have_css("a", text: "Name")
+ end
+
it "counts only the active facilitator for an org with an ended one" do
get populations_served_organization_path(beacon)
diff --git a/spec/requests/organizations_spec.rb b/spec/requests/organizations_spec.rb
index 99b2b8a02d..52206ea86e 100644
--- a/spec/requests/organizations_spec.rb
+++ b/spec/requests/organizations_spec.rb
@@ -252,7 +252,7 @@
expect(page).not_to have_content("Former Sector")
end
- it "sorts the breakdown by the chosen option, defaulting to primary first" do
+ it "sorts the breakdown by the chosen option, defaulting to most primary first" do
person = organization_with_sectors.affiliations.first.person
%w[Echo Foxtrot].each { |name| create(:sectorable_item, sector: create(:sector, name: name), sectorable: person, is_primary: false) }
second = create(:person)
@@ -263,7 +263,7 @@
get populations_served_organization_url(organization_with_sectors)
expect(sector_order.call).to eq(%w[Alpha Bravo Charlie Delta Echo Foxtrot])
- expect(Capybara.string(response.body)).to have_css("a[aria-current='true']", exact_text: "Primary first")
+ expect(Capybara.string(response.body)).to have_css("a[aria-current='true']", exact_text: "Primary")
get populations_served_organization_url(organization_with_sectors, sort: "total")
expect(sector_order.call).to eq(%w[Echo Alpha Bravo Charlie Delta Foxtrot])
@@ -272,7 +272,26 @@
expect(sector_order.call).to eq(%w[Alpha Bravo Charlie Delta Echo Foxtrot])
get populations_served_organization_url(organization_with_sectors, sort: "bogus")
- expect(Capybara.string(response.body)).to have_css("a[aria-current='true']", exact_text: "Primary first")
+ expect(Capybara.string(response.body)).to have_css("a[aria-current='true']", exact_text: "Primary")
+ end
+
+ it "reverses the chosen sort and offers to flip it back" do
+ person = organization_with_sectors.affiliations.first.person
+ %w[Echo Foxtrot].each { |name| create(:sectorable_item, sector: create(:sector, name: name), sectorable: person, is_primary: false) }
+ second = create(:person)
+ create(:affiliation, organization: organization_with_sectors, person: second)
+ create(:sectorable_item, sector: Sector.find_by!(name: "Echo"), sectorable: second, is_primary: false)
+ sector_order = -> { Capybara.string(response.body).all("section", text: "Sectors").first.all("li a").map(&:text) }
+
+ get populations_served_organization_url(organization_with_sectors, sort: "total", direction: "asc")
+ expect(sector_order.call).to eq(%w[Foxtrot Alpha Bravo Charlie Delta Echo])
+
+ get populations_served_organization_url(organization_with_sectors, sort: "name", direction: "desc")
+ expect(sector_order.call).to eq(%w[Foxtrot Echo Delta Charlie Bravo Alpha])
+ active = Capybara.string(response.body).find("a[aria-current='true']")
+ expect(active).to have_text("Name")
+ expect(active).to have_css("i.fa-arrow-down")
+ expect(active[:href]).to include("direction=asc")
end
it "caps the edit page at three sectors with links to the breakdown that return to the edit page" do
@@ -334,7 +353,7 @@
page = Capybara.string(response.body)
expect(page).to have_content("This organization doesn't show sectors or age groups on its profile.")
expect(page).not_to have_css("section h2")
- expect(page).not_to have_link("Primary first")
+ expect(page).not_to have_link("Primary", exact: true)
end
it "hides the profile and edit links to the breakdown when both are hidden" do
diff --git a/spec/requests/users_spec.rb b/spec/requests/users_spec.rb
index 105aeed813..bb35d30695 100644
--- a/spec/requests/users_spec.rb
+++ b/spec/requests/users_spec.rb
@@ -60,6 +60,14 @@
expect(response.body).to include("direction=desc&search=sort%40example&sort=email")
end
+ it "marks the active sort on the small-screen sort strip" do
+ get users_url(sort: "email", direction: "asc"), headers: { "Turbo-Frame" => "users_results" }
+
+ active = Capybara.string(response.body).find("a[aria-current='true']")
+ expect(active).to have_text("Email")
+ expect(active).to have_css("i.fa-arrow-up")
+ end
+
it "sorts by person alongside a search" do
get users_url(sort: "person", search: "example"), headers: { "Turbo-Frame" => "users_results" }
diff --git a/spec/requests/workshops_spec.rb b/spec/requests/workshops_spec.rb
index d51e4772ae..8a2735c486 100644
--- a/spec/requests/workshops_spec.rb
+++ b/spec/requests/workshops_spec.rb
@@ -484,6 +484,14 @@
expect(response).to have_http_status(:ok)
end
+
+ it "checks the chosen sort on the sort strip" do
+ get workshops_url, params: { sort: "popularity" }
+
+ page = Capybara.string(response.body)
+ expect(page).to have_css("input[type=radio][name=sort][value=popularity][checked]", visible: :all)
+ expect(page).to have_css("label", text: "Author")
+ end
end
end
end