Sha256: b3446fa42c7a209c9a24a016796728c73d638ef0ea2307e87100cd713f0182c0

Contents?: true

Size: 1.05 KB

Versions: 8

Compression:

Stored size: 1.05 KB

Contents

# frozen_string_literal: true

module Decidim
  module Admin
    # Controller that allows managing participatory processes.
    #
    class ParticipatoryProcessCopiesController < Decidim::Admin::ApplicationController
      include Concerns::ParticipatoryProcessAdmin

      def new
        authorize! :new, Decidim::ParticipatoryProcess
        @form = form(ParticipatoryProcessCopyForm).from_model(current_participatory_process)
      end

      def create
        authorize! :create, Decidim::ParticipatoryProcess
        @form = form(ParticipatoryProcessCopyForm).from_params(params)

        CopyParticipatoryProcess.call(@form, current_participatory_process) do
          on(:ok) do
            flash[:notice] = I18n.t("participatory_processes_copies.create.success", scope: "decidim.admin")
            redirect_to participatory_processes_path
          end

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

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
decidim-admin-0.5.1 app/controllers/decidim/admin/participatory_process_copies_controller.rb
decidim-0.5.1 decidim-admin/app/controllers/decidim/admin/participatory_process_copies_controller.rb
decidim-admin-0.5.0 app/controllers/decidim/admin/participatory_process_copies_controller.rb
decidim-0.5.0 decidim-admin/app/controllers/decidim/admin/participatory_process_copies_controller.rb
decidim-admin-0.4.4 app/controllers/decidim/admin/participatory_process_copies_controller.rb
decidim-0.4.4 decidim-admin/app/controllers/decidim/admin/participatory_process_copies_controller.rb
decidim-admin-0.4.3 app/controllers/decidim/admin/participatory_process_copies_controller.rb
decidim-0.4.3 decidim-admin/app/controllers/decidim/admin/participatory_process_copies_controller.rb