From bec5f59391ccf4d3b98a680686a1eeb685955e71 Mon Sep 17 00:00:00 2001 From: Robin Steiner Date: Tue, 26 Mar 2024 16:10:50 +0100 Subject: [PATCH] Fix selected pill with an override --- .../process_filters_cell_override.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 app/overrides/cells/decidim/participatory_processes/process_filters_cell_override.rb diff --git a/app/overrides/cells/decidim/participatory_processes/process_filters_cell_override.rb b/app/overrides/cells/decidim/participatory_processes/process_filters_cell_override.rb new file mode 100644 index 00000000..4566a070 --- /dev/null +++ b/app/overrides/cells/decidim/participatory_processes/process_filters_cell_override.rb @@ -0,0 +1,16 @@ +# frozen_string_literal: true + +# We would love to do a prepend instead of what is happening here +# For whatever reason though the prepend never properly works +# Even if we include the module it doesn't get loaded +# Must be some crazy loading shenanigans +# Pry-ing into the customization class and using the following commands might be useful for future debugging: +# $ -a Decidim::ParticipatoryProcesses::ProcessFiltersCell +# $ -a DecidimZuerich::ParticipatoryProcesses::ProcessFiltersCell +Decidim::ParticipatoryProcesses::ProcessFiltersCell.class_eval do + def other_filters_with_value + @other_filters_with_value ||= [current_filter] + other_filters.select do |filter| + process_count_by_filter[filter].positive? + end + end +end \ No newline at end of file