Sha256: 7f949ae3267987e6a4d6bf85f0d75f8172b0c53c84c1e7e72e4103d0b8bd088c

Contents?: true

Size: 1.14 KB

Versions: 19

Compression:

Stored size: 1.14 KB

Contents

# frozen_string_literal: true

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

        def new
          enforce_permission_to :create, :process
          @form = form(ParticipatoryProcessCopyForm).from_model(current_participatory_process)
        end

        def create
          enforce_permission_to :create, :process
          @form = form(ParticipatoryProcessCopyForm).from_params(params)

          CopyParticipatoryProcess.call(@form, current_participatory_process, current_user) 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
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.28.4 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.27.9 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.28.3 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.27.8 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.28.2 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.27.7 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.28.1 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.27.6 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.28.0 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.27.5 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.28.0.rc5 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.28.0.rc4 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.27.4 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.27.3 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.27.2 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.27.1 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.27.0 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.27.0.rc2 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb
decidim-participatory_processes-0.27.0.rc1 app/controllers/decidim/participatory_processes/admin/participatory_process_copies_controller.rb