Class: Decidim::Consultations::QuestionMultipleVotesController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- Decidim::Consultations::QuestionMultipleVotesController
- Includes:
- NeedsQuestion, FormFactory
- Defined in:
- app/controllers/decidim/consultations/question_multiple_votes_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
-
#show ⇒ Object
Non-ajax votings (such as multi-reponses) have a html page.
Methods included from NeedsQuestion
enhance_controller, extended, included
Instance Method Details
#create ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/decidim/consultations/question_multiple_votes_controller.rb', line 20 def create :vote, :question, question: current_question multivote_form = form(MultiVoteForm).from_params(params, current_question: current_question) MultipleVoteQuestion.call(multivote_form, current_user) do on(:ok) do redirect_to question_path(current_question) end on(:invalid) do |_form, error| flash[:error] = I18n.t("question_votes.create.error", scope: "decidim.consultations") flash[:error] << " (#{error})" if error redirect_to question_question_multiple_votes_path end end end |
#show ⇒ Object
Non-ajax votings (such as multi-reponses) have a html page
15 16 17 18 |
# File 'app/controllers/decidim/consultations/question_multiple_votes_controller.rb', line 15 def show :vote, :question, question: current_question @form = form(MultiVoteForm).instance(current_question: current_question) end |