Class: Decidim::Proposals::ProposalVotesController
- Inherits:
-
ApplicationController
- Object
- Features::BaseController
- ApplicationController
- Decidim::Proposals::ProposalVotesController
- Includes:
- ProposalVotesHelper
- Defined in:
- app/controllers/decidim/proposals/proposal_votes_controller.rb
Overview
Exposes the proposal vote resource so users can vote proposals.
Instance Method Summary collapse
Methods included from ProposalVotesHelper
#remaining_votes_count_for, #vote_button_classes, #vote_limit_enabled?, #votes_count_classes
Instance Method Details
#create ⇒ Object
13 14 15 16 17 18 19 |
# File 'app/controllers/decidim/proposals/proposal_votes_controller.rb', line 13 def create :vote, proposal proposal.votes.create!(author: current_user) @from_proposals_list = params[:from_proposals_list] == "true" render :update_buttons_and_counters end |
#destroy ⇒ Object
21 22 23 24 25 26 27 |
# File 'app/controllers/decidim/proposals/proposal_votes_controller.rb', line 21 def destroy :unvote, proposal proposal.votes.where(author: current_user).delete_all @from_proposals_list = params[:from_proposals_list] == "true" render :update_buttons_and_counters end |