Module: Decidim::Accountability::BreadcrumbHelper

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

Instance Method Details

#categoryObject


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_scopeObject


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

#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_calculatorObject


8
9
10
# File 'decidim-accountability/app/helpers/decidim/accountability/breadcrumb_helper.rb', line 8

def stats_calculator
  @stats_calculator ||= ResultStatsCalculator.new(result)
end