Sha256: 77060f302e1e8917f37afd1ea894613988b06dfa1d105d22420b3cc3fdf629c4

Contents?: true

Size: 1.28 KB

Versions: 32

Compression:

Stored size: 1.28 KB

Contents

# frozen_string_literal: true

module Decidim
  module Assemblies
    module Admin
      # Controller that allows managing assembly publications.
      #
      class AssemblyPublicationsController < Decidim::Admin::ApplicationController
        include Concerns::AssemblyAdmin

        def create
          authorize! :publish, current_assembly

          PublishAssembly.call(current_assembly) 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
          authorize! :publish, current_assembly

          UnpublishAssembly.call(current_assembly) 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

32 entries across 32 versions & 2 rubygems

Version Path
decidim-assemblies-0.9.3 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.9.2 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.9.1 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.9.0 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.8.4 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.8.3 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.8.2 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.8.1 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.8.0 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.7.4 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.7.3 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.7.2 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.7.1 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.7.0 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.6.8 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-0.6.8 decidim-assemblies/app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.6.7 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-0.6.7 decidim-assemblies/app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-assemblies-0.6.6 app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb
decidim-0.6.6 decidim-assemblies/app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb