Class: Decidim::Proposals::Admin::ProposalAnswersController
- Inherits:
-
ApplicationController
- Object
- Admin::Components::BaseController
- ApplicationController
- Decidim::Proposals::Admin::ProposalAnswersController
- Defined in:
- app/controllers/decidim/proposals/admin/proposal_answers_controller.rb
Overview
This controller allows admins to answer proposals in a participatory process.
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
15 16 17 18 |
# File 'app/controllers/decidim/proposals/admin/proposal_answers_controller.rb', line 15 def edit (:create, :proposal_answer, proposal:) @form = form(Admin::ProposalAnswerForm).from_model(proposal) end |
#update ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'app/controllers/decidim/proposals/admin/proposal_answers_controller.rb', line 20 def update (:create, :proposal_answer, proposal:) @notes_form = form(ProposalNoteForm).instance @answer_form = form(Admin::ProposalAnswerForm).from_params(params) Admin::AnswerProposal.call(@answer_form, proposal) do on(:ok) do flash[:notice] = I18n.t("proposals.answer.success", scope: "decidim.proposals.admin") redirect_to proposals_path end on(:invalid) do flash.keep[:alert] = I18n.t("proposals.answer.invalid", scope: "decidim.proposals.admin") render template: "decidim/proposals/admin/proposals/show" end end end |