Module: Decidim::Assemblies::FilterAssembliesHelper
- Includes:
- CheckBoxesTreeHelper
- Included in:
- AssembliesHelper
- Defined in:
- app/helpers/decidim/assemblies/filter_assemblies_helper.rb
Overview
Helpers related to the Assemblies filters.
Instance Method Summary collapse
Instance Method Details
#assembly_types ⇒ Object
9 10 11 |
# File 'app/helpers/decidim/assemblies/filter_assemblies_helper.rb', line 9 def assembly_types @assembly_types ||= AssembliesType.where(organization: current_organization).joins(:assemblies).distinct end |
#filter_sections ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/helpers/decidim/assemblies/filter_assemblies_helper.rb', line 22 def filter_sections [ { method: :with_any_scope, collection: filter_global_scopes_values, label_scope: "decidim.shared.participatory_space_filters.filters", id: "scope" }, { method: :with_any_area, collection: filter_areas_values, label_scope: "decidim.shared.participatory_space_filters.filters", id: "area" }, { method: :with_any_type, collection: filter_types_values, label_scope: "decidim.assemblies.assemblies.filters", id: "type" } ].reject { |item| item[:collection].blank? } end |
#filter_types_values ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'app/helpers/decidim/assemblies/filter_assemblies_helper.rb', line 13 def filter_types_values return if assembly_types.blank? type_values = assembly_types.map { |type| [type.id.to_s, translated_attribute(type.title)] } type_values.prepend(["", t("decidim.assemblies.assemblies.filters.names.all")]) filter_tree_from_array(type_values) end |