Module: Decidim::Accountability::BreadcrumbHelper
- Included in:
- StatusCell
- Defined in:
- 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
Instance Method Details
#categories_hierarchy ⇒ Object
28 29 30 |
# File 'app/helpers/decidim/accountability/breadcrumb_helper.rb', line 28 def categories_hierarchy parent_categories(category) end |
#category ⇒ Object
16 17 18 19 20 |
# File 'app/helpers/decidim/accountability/breadcrumb_helper.rb', line 16 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
8 9 10 |
# File 'app/helpers/decidim/accountability/breadcrumb_helper.rb', line 8 def current_scope params[:filter][:with_scope] if params[:filter] end |
#parent_categories(category) ⇒ Object
22 23 24 25 26 |
# File 'app/helpers/decidim/accountability/breadcrumb_helper.rb', line 22 def parent_categories(category) return [] if category&.parent.blank? [*parent_categories(category.parent), category.parent] end |
#progress_calculator(scope_id, category_id) ⇒ Object
12 13 14 |
# File 'app/helpers/decidim/accountability/breadcrumb_helper.rb', line 12 def progress_calculator(scope_id, category_id) Decidim::Accountability::ResultsCalculator.new(current_component, scope_id, category_id).progress end |