Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion app/views/story_shares/_sector_index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@

<!-- Section Title -->
<h1 class="text-2xl font-bold text-red-700 mb-6">
<%= params[:sector_names_all].to_s.titleize %>
<%# Sector names carry intentional casing ("LGBTQIA+", "Self-Care/Personal
Growth"); render them as stored rather than running .titleize. %>
<%= @sector_names_all.to_sentence %>
</h1>

<% if @stories_by_sector.first.second.any? %>
Expand Down
4 changes: 3 additions & 1 deletion app/views/workshops/_dropdown_filter.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@
params.dig(param_name, item.id.to_s).to_s == item.id.to_s,
id: "#{param_name}_#{item.id}",
class: "category-checkbox" %>
<%# Render the label as stored β€” sector names carry intentional casing
(e.g. "LGBTQIA+", "Child Abuse/Neglect") that .humanize would flatten. %>
<%= label_tag "#{param_name}_#{item.id}",
item.public_send(label_method).humanize,
item.public_send(label_method),
class: "text-sm text-gray-700" %>
</div>
<% end %>
Expand Down
15 changes: 15 additions & 0 deletions spec/requests/workshops_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@
end
end

# --- SECTOR FILTER LABELS --------------------------------------------------
describe "sector filter dropdown labels" do
let(:admin) { create(:user, :admin) }
let!(:sector) { create(:sector, :published, name: "LGBTQIA+") }

before { sign_in admin }

it "renders sector names with their canonical casing, not sentence case" do
get workshops_url

expect(response.body).to include("LGBTQIA+")
expect(response.body).not_to include("Lgbtqia+")
end
end

# --- DESTROY ---------------------------------------------------------------
describe "DELETE /destroy" do
let(:user) { create(:user) }
Expand Down