Module: Decidim::Accountability::BreadcrumbHelper
- Included in:
- StatusCell
- Defined in:
- decidim-accountability/app/helpers/decidim/accountability/breadcrumb_helper.rb
Overview
Helpers needed to render the navigation breadcrumbs in results.
Instance Method Summary collapse
- #categories_hierarchy ⇒ Object
- #category ⇒ Object
- #current_scope ⇒ Object
- #parent_categories(category) ⇒ Object
- #progress_calculator(scope_id, category_id) ⇒ Object
- #stats_calculator ⇒ Object
Instance Method Details
#categories_hierarchy ⇒ Object
32 33 34 |
# File 'decidim-accountability/app/helpers/decidim/accountability/breadcrumb_helper.rb', line 32 def categories_hierarchy parent_categories(category) end |
#category ⇒ Object
20 21 22 23 24 |
# File 'decidim-accountability/app/helpers/decidim/accountability/breadcrumb_helper.rb', line 20 def category return if (category_id = params.dig(:filter, :with_category)).blank? @category ||= current_participatory_space.categories.find(category_id.is_a?(Array) ? category_id.first : category_id) end |
#current_scope ⇒ Object
12 13 14 |
# File 'decidim-accountability/app/helpers/decidim/accountability/breadcrumb_helper.rb', line 12 def current_scope params[:filter][:with_scope] if params[:filter] end |
#parent_categories(category) ⇒ Object
26 27 28 29 30 |
# File 'decidim-accountability/app/helpers/decidim/accountability/breadcrumb_helper.rb', line 26 def parent_categories(category) return [] if category&.parent.blank? [*parent_categories(category.parent), category.parent] end |
#progress_calculator(scope_id, category_id) ⇒ Object
16 17 18 |
# File 'decidim-accountability/app/helpers/decidim/accountability/breadcrumb_helper.rb', line 16 def progress_calculator(scope_id, category_id) Decidim::Accountability::ResultsCalculator.new(current_component, scope_id, category_id).progress end |
#stats_calculator ⇒ Object
8 9 10 |
# File 'decidim-accountability/app/helpers/decidim/accountability/breadcrumb_helper.rb', line 8 def stats_calculator @stats_calculator ||= ResultStatsCalculator.new(result) end |