Sha256: 3efc0c6a85503018679b0ccf0c366ceb61ef7738a639a19a85c6e0f29832529b

Contents?: true

Size: 971 Bytes

Versions: 6

Compression:

Stored size: 971 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Elections
    # This controller allows a user to give feedback once finished voting
    class FeedbacksController < Decidim::Elections::ApplicationController
      include Decidim::Forms::Concerns::HasQuestionnaire
      helper_method :election

      def questionnaire_for
        election
      end

      # where the questionnaire will be submitted.
      def update_url
        answer_election_feedback_path(election)
      end

      private

      def election
        @election ||= Election.where(component: current_component).includes(:questionnaire).find(params[:election_id])
      end

      def allow_answers?
        current_user.present? && election.ongoing?
      end

      def i18n_flashes_scope
        "decidim.elections.feedback"
      end

      def enforce_permission_to_answer_questionnaire
        enforce_permission_to :answer, :questionnaire, election: election
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
decidim-elections-0.24.3 app/controllers/decidim/elections/feedbacks_controller.rb
decidim-elections-0.24.2 app/controllers/decidim/elections/feedbacks_controller.rb
decidim-elections-0.24.1 app/controllers/decidim/elections/feedbacks_controller.rb
decidim-elections-0.24.0 app/controllers/decidim/elections/feedbacks_controller.rb
decidim-elections-0.24.0.rc2 app/controllers/decidim/elections/feedbacks_controller.rb
decidim-elections-0.24.0.rc1 app/controllers/decidim/elections/feedbacks_controller.rb