Sha256: b036cdd7487e1300217076a6efa5c54283e9f751e736c72f47a3d47185f6f1c4

Contents?: true

Size: 788 Bytes

Versions: 12

Compression:

Stored size: 788 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Accountability
    # Helpers needed to render the navigation breadcrumbs in results.
    #
    module BreadcrumbHelper
      def stats_calculator
        @stats_calculator ||= ResultStatsCalculator.new(result)
      end

      def current_scope
        params[:filter][:with_scope] if params[:filter]
      end

      def progress_calculator(scope_id, category_id)
        Decidim::Accountability::ResultsCalculator.new(current_component, scope_id, category_id).progress
      end

      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
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
decidim-accountability-0.27.9 app/helpers/decidim/accountability/breadcrumb_helper.rb
decidim-accountability-0.27.8 app/helpers/decidim/accountability/breadcrumb_helper.rb
decidim-accountability-0.27.7 app/helpers/decidim/accountability/breadcrumb_helper.rb
decidim-accountability-0.27.6 app/helpers/decidim/accountability/breadcrumb_helper.rb
decidim-accountability-0.27.5 app/helpers/decidim/accountability/breadcrumb_helper.rb
decidim-accountability-0.27.4 app/helpers/decidim/accountability/breadcrumb_helper.rb
decidim-accountability-0.27.3 app/helpers/decidim/accountability/breadcrumb_helper.rb
decidim-accountability-0.27.2 app/helpers/decidim/accountability/breadcrumb_helper.rb
decidim-accountability-0.27.1 app/helpers/decidim/accountability/breadcrumb_helper.rb
decidim-accountability-0.27.0 app/helpers/decidim/accountability/breadcrumb_helper.rb
decidim-accountability-0.27.0.rc2 app/helpers/decidim/accountability/breadcrumb_helper.rb
decidim-accountability-0.27.0.rc1 app/helpers/decidim/accountability/breadcrumb_helper.rb