Sha256: 63adc136b896d6fe36222bd8fb95e36340d97c1fc11f7a8514dbc9d445f1c729

Contents?: true

Size: 961 Bytes

Versions: 12

Compression:

Stored size: 961 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Results
    # Exposes the result resource so users can view them
    class ResultsController < Decidim::Results::ApplicationController
      include FilterResource
      helper Decidim::WidgetUrlsHelper

      helper_method :results, :result, :stats_calculator

      private

      def results
        @results ||= search.results.order("title -> '#{I18n.locale}' ASC").page(params[:page]).per(12)
      end

      def result
        @result ||= results.find(params[:id])
      end

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

      def search_klass
        ResultSearch
      end

      def default_filter_params
        {
          search_text: "",
          scope_id: "",
          category_id: ""
        }
      end

      def context_params
        { feature: current_feature, organization: current_organization }
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 2 rubygems

Version Path
decidim-results-0.4.0 app/controllers/decidim/results/results_controller.rb
decidim-0.4.0 decidim-results/app/controllers/decidim/results/results_controller.rb
decidim-results-0.3.2 app/controllers/decidim/results/results_controller.rb
decidim-0.3.2 decidim-results/app/controllers/decidim/results/results_controller.rb
decidim-results-0.3.1 app/controllers/decidim/results/results_controller.rb
decidim-0.3.1 decidim-results/app/controllers/decidim/results/results_controller.rb
decidim-results-0.3.0 app/controllers/decidim/results/results_controller.rb
decidim-0.3.0 decidim-results/app/controllers/decidim/results/results_controller.rb
decidim-results-0.2.0 app/controllers/decidim/results/results_controller.rb
decidim-0.2.0 decidim-results/app/controllers/decidim/results/results_controller.rb
decidim-results-0.1.0 app/controllers/decidim/results/results_controller.rb
decidim-0.1.0 decidim-results/app/controllers/decidim/results/results_controller.rb