Sha256: 4929430ddf991976bab74c9e9ef254443c1f93be5064227d82bce2df25757297
Contents?: true
Size: 1.09 KB
Versions: 12
Compression:
Stored size: 1.09 KB
Contents
# frozen_string_literal: true module Decidim module Debates module Admin # This controller allows an admin to close debates class DebateClosesController < Admin::ApplicationController helper_method :debate def edit enforce_permission_to :close, :debate, debate: debate @form = form(Admin::CloseDebateForm).from_model(debate) end def update enforce_permission_to :close, :debate, 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 private def debate @debate ||= Debate.where(component: current_component).find(params[:id]) end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems