Skip to content
Open
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
3 changes: 2 additions & 1 deletion app/views/taggings/_explore_by_combination.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<% selected_sectors =
@sector_names_all.to_s.split("--").map(&:strip).reject(&:blank?) %>

<% Sector.published.order(:name).each do |sector| %>
<% Sector.published.has_taggings.order(:name).each do |sector| %>
<label class="flex items-center gap-2 px-3 py-1 text-sm cursor-pointer
hover:bg-lime-50">
<input type="checkbox"
Expand Down Expand Up @@ -61,6 +61,7 @@
%>

<% Category.published
.has_taggings
.joins(:category_type)
.select("categories.*, category_types.name AS category_type_name")
.distinct
Expand Down
2 changes: 1 addition & 1 deletion app/views/taggings/_explore_by_sector.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</h3>

<div class="flex flex-wrap justify-center gap-2 mb-6">
<% Sector.published.order(:name).each do |sector| %>
<% Sector.published.has_taggings.order(:name).each do |sector| %>
<% next if sector.name == @sector_names %>
<%= render "sectors/tagging_label", sector: sector %>
<% end %>
Expand Down
3 changes: 2 additions & 1 deletion spec/requests/taggings_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
let!(:workshop) { create(:workshop, :published, title: "Art for Healing") }

before do
# Make the sector + category actually appear via joins
# Make the sectors + category actually appear via joins
create(:sectorable_item, sector: sector_1, sectorable: workshop)
create(:sectorable_item, sector: sector_2, sectorable: workshop)
create(:categorizable_item, category: category, categorizable: workshop)

Expand Down
6 changes: 6 additions & 0 deletions spec/system/taggings_multiselect_filter_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
let!(:category_trauma) { create(:category, :published, name: "Trauma", category_type: category_type_theme) }

# Create workshops with tags
let!(:workshop_veterans) do
workshop = create(:workshop, :published, title: "Veterans Workshop")
create(:sectorable_item, sector: sector_veterans, sectorable: workshop)
workshop
end

let!(:workshop_youth_healing) do
workshop = create(:workshop, :published, title: "Youth Healing Workshop")
create(:sectorable_item, sector: sector_youth, sectorable: workshop)
Expand Down
Loading