Class: Decidim::Debates::Admin::DebateClosesController
- Inherits:
-
ApplicationController
- Object
- Admin::Components::BaseController
- ApplicationController
- Decidim::Debates::Admin::DebateClosesController
- Defined in:
- app/controllers/decidim/debates/admin/debate_closes_controller.rb
Overview
This controller allows an admin to close debates
Instance Method Summary collapse
Instance Method Details
#edit ⇒ Object
10 11 12 13 14 |
# File 'app/controllers/decidim/debates/admin/debate_closes_controller.rb', line 10 def edit (:close, :debate, debate:) @form = form(Admin::CloseDebateForm).from_model(debate) end |
#update ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/controllers/decidim/debates/admin/debate_closes_controller.rb', line 16 def update (:close, :debate, debate:) @form = form(Admin::CloseDebateForm).from_params(params) CloseDebate.call(@form) do on(:ok) do |_debate| flash[:notice] = I18n.t("debates.close.success", scope: "decidim.debates") redirect_to debates_path end on(:invalid) do flash.now[:alert] = I18n.t("debates.close.invalid", scope: "decidim.debates") render action: "edit" end end end |