Sha256: b94577aea795ea7d2a199d7b7e090a1169a585f151bb1707ecb2ca039e6b00be
Contents?: true
Size: 1.31 KB
Versions: 3
Compression:
Stored size: 1.31 KB
Contents
# frozen_string_literal: true module Decidim module Consultations module Admin # Controller that allows managing consultation publications. class ConsultationPublicationsController < Decidim::Admin::ApplicationController include ConsultationAdmin def create authorize! :publish, 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 authorize! :publish, 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
3 entries across 3 versions & 1 rubygems