Sha256: 57066c21e91d5530cdc050a2e84f9721f789376286afe7a9cf0b0e3069c98222
Contents?: true
Size: 1.38 KB
Versions: 72
Compression:
Stored size: 1.38 KB
Contents
# frozen_string_literal: true module Decidim module Assemblies module Admin # Controller that allows managing assembly publications. # class AssemblyPublicationsController < Decidim::Assemblies::Admin::ApplicationController include Concerns::AssemblyAdmin def create enforce_permission_to :publish, :assembly, assembly: current_assembly PublishAssembly.call(current_assembly, current_user) do on(:ok) do flash[:notice] = I18n.t("assembly_publications.create.success", scope: "decidim.admin") end on(:invalid) do flash.now[:alert] = I18n.t("assembly_publications.create.error", scope: "decidim.admin") end redirect_back(fallback_location: assemblies_path) end end def destroy enforce_permission_to :publish, :assembly, assembly: current_assembly UnpublishAssembly.call(current_assembly, current_user) do on(:ok) do flash[:notice] = I18n.t("assembly_publications.destroy.success", scope: "decidim.admin") end on(:invalid) do flash.now[:alert] = I18n.t("assembly_publications.destroy.error", scope: "decidim.admin") end redirect_back(fallback_location: assemblies_path) end end end end end end
Version data entries
72 entries across 72 versions & 1 rubygems