Module: Decidim::Elections::UsesVotesBooth

Extended by:
ActiveSupport::Concern
Included in:
PerQuestionVotesController, VotesController
Defined in:
app/controllers/concerns/decidim/elections/uses_votes_booth.rb

Overview

Provides access to election resources so that users can participate Election.where(component: current_component).published.lections.

Instance Method Summary collapse

Instance Method Details

#receiptObject

Shows the receipt page



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'app/controllers/concerns/decidim/elections/uses_votes_booth.rb', line 49

def receipt
  if params[:exit].present?
    votes_buffer.clear
    session_attributes.clear
    return redirect_to(exit_path)
  end

  enforce_permission_to(:create, :vote, election:)

  votes_buffer.clear unless election.per_question?

  return redirect_to(exit_path) unless election.votes.exists?(voter_uid: session[:voter_uid])

  render "decidim/elections/votes/receipt"
end