Module: Decidim::Assemblies::FilterAssembliesHelper
Overview
Helpers related to the Assemblies filters.
Instance Method Summary
collapse
#check_boxes_tree_options, #filter_areas_values, #filter_global_scopes_values, #filter_origin_values, #filter_taxonomy_values_children, #filter_taxonomy_values_for, #filter_text_for, #filter_tree_from_array, #flat_filter_values
#decidim_escape_translated, #decidim_html_escape, #decidim_rich_text, #decidim_sanitize, #decidim_sanitize_admin, #decidim_sanitize_editor, #decidim_sanitize_editor_admin, #decidim_sanitize_newsletter, #decidim_sanitize_translated, #decidim_url_escape, included
Instance Method Details
#assembly_types ⇒ Object
9
10
11
|
# File 'decidim-assemblies/app/helpers/decidim/assemblies/filter_assemblies_helper.rb', line 9
def assembly_types
@assembly_types ||= AssembliesType.where(organization: current_organization).joins(:assemblies).distinct
end
|
#available_taxonomy_filters ⇒ Object
37
38
39
|
# File 'decidim-assemblies/app/helpers/decidim/assemblies/filter_assemblies_helper.rb', line 37
def available_taxonomy_filters
Decidim::TaxonomyFilter.for(:assemblies)
end
|
#filter_sections ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'decidim-assemblies/app/helpers/decidim/assemblies/filter_assemblies_helper.rb', line 22
def filter_sections
items = [
{ method: :with_any_type, collection: filter_types_values, label: t("decidim.assemblies.assemblies.filters.type"), id: "type" }
]
available_taxonomy_filters.find_each do |taxonomy_filter|
items.append(method: "with_any_taxonomies[#{taxonomy_filter.root_taxonomy_id}]",
collection: filter_taxonomy_values_for(taxonomy_filter),
label: decidim_sanitize_translated(taxonomy_filter.name),
id: "taxonomy")
end
items.reject { |item| item[:collection].blank? }
end
|
#filter_types_values ⇒ Object
13
14
15
16
17
18
19
20
|
# File 'decidim-assemblies/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
|