Sha256: 66b261a2d955c498c7fa9b8596eea8a7b0f1385cc47f69699e080a5e36b8ba4b
Contents?: true
Size: 1.4 KB
Versions: 11
Compression:
Stored size: 1.4 KB
Contents
# frozen_string_literal: true module Decidim module Consultations module Admin # Controller that allows managing consultation publications. class ConsultationPublicationsController < Decidim::Consultations::Admin::ApplicationController include ConsultationAdmin def create enforce_permission_to :publish, :consultation, consultation: current_consultation PublishConsultation.call(current_consultation) do on(:ok) do flash[:notice] = I18n.t("consultation_publications.create.success", scope: "decidim.admin") end on(:invalid) do flash[:alert] = I18n.t("consultation_publications.create.error", scope: "decidim.admin") end redirect_back(fallback_location: consultations_path) end end def destroy enforce_permission_to :publish, :consultation, consultation: current_consultation UnpublishConsultation.call(current_consultation) do on(:ok) do flash[:notice] = I18n.t("consultation_publications.destroy.success", scope: "decidim.admin") end on(:invalid) do flash[:alert] = I18n.t("consultation_publications.destroy.error", scope: "decidim.admin") end redirect_back(fallback_location: consultations_path) end end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems