Sha256: 1aa716ea0a73e19322119f4fb5d10191e6b87c6536c37af99ebffe326177ed36

Contents?: true

Size: 1.37 KB

Versions: 9

Compression:

Stored size: 1.37 KB

Contents

# frozen_string_literal: true
require_dependency "decidim/admin/application_controller"

module Decidim
  module Admin
    # Controller that allows managing all the Admins.
    #
    class ParticipatoryProcessPublicationsController < ApplicationController
      include Concerns::ParticipatoryProcessAdmin

      def create
        authorize! :publish, participatory_process

        PublishParticipatoryProcess.call(participatory_process) do
          on(:ok) do
            flash[:notice] = I18n.t("participatory_process_publications.create.success", scope: "decidim.admin")
          end

          on(:invalid) do
            flash.now[:alert] = I18n.t("participatory_process_publications.create.error", scope: "decidim.admin")
          end

          redirect_back(fallback_location: participatory_processes_path)
        end
      end

      def destroy
        authorize! :publish, participatory_process

        UnpublishParticipatoryProcess.call(participatory_process) do
          on(:ok) do
            flash[:notice] = I18n.t("participatory_process_publications.destroy.success", scope: "decidim.admin")
          end

          on(:invalid) do
            flash.now[:alert] = I18n.t("participatory_process_publications.destroy.error", scope: "decidim.admin")
          end

          redirect_back(fallback_location: participatory_processes_path)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
decidim-admin-0.0.5 app/controllers/decidim/admin/participatory_process_publications_controller.rb
decidim-0.0.5 decidim-admin/app/controllers/decidim/admin/participatory_process_publications_controller.rb
decidim-0.0.4 decidim-admin/app/controllers/decidim/admin/participatory_process_publications_controller.rb
decidim-admin-0.0.3 app/controllers/decidim/admin/participatory_process_publications_controller.rb
decidim-0.0.3 decidim-admin/app/controllers/decidim/admin/participatory_process_publications_controller.rb
decidim-admin-0.0.2 app/controllers/decidim/admin/participatory_process_publications_controller.rb
decidim-0.0.2 decidim-admin/app/controllers/decidim/admin/participatory_process_publications_controller.rb
decidim-admin-0.0.1 app/controllers/decidim/admin/participatory_process_publications_controller.rb
decidim-0.0.1 decidim-admin/app/controllers/decidim/admin/participatory_process_publications_controller.rb