Sha256: a45f5c6e60227fa95e1859e98507361d9b453ea6a28027e477d074fc7fd0e1ba

Contents?: true

Size: 989 Bytes

Versions: 49

Compression:

Stored size: 989 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module ParticipatoryProcesses
    module Admin
      class ParticipatoryProcessImportsController < Decidim::ParticipatoryProcesses::Admin::ApplicationController
        def new
          enforce_permission_to :import, :process
          @form = form(ParticipatoryProcessImportForm).instance
        end

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

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

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

Version data entries

49 entries across 49 versions & 1 rubygems

Version Path
decidim-participatory_processes-0.23.3 app/controllers/decidim/participatory_processes/admin/participatory_process_imports_controller.rb
decidim-participatory_processes-0.23.2 app/controllers/decidim/participatory_processes/admin/participatory_process_imports_controller.rb
decidim-participatory_processes-0.23.1 app/controllers/decidim/participatory_processes/admin/participatory_process_imports_controller.rb
decidim-participatory_processes-0.23.1.rc1 app/controllers/decidim/participatory_processes/admin/participatory_process_imports_controller.rb
decidim-participatory_processes-0.23.0 app/controllers/decidim/participatory_processes/admin/participatory_process_imports_controller.rb
decidim-participatory_processes-0.22.0 app/controllers/decidim/participatory_processes/admin/participatory_process_imports_controller.rb
decidim-participatory_processes-0.21.0 app/controllers/decidim/participatory_processes/admin/participatory_process_imports_controller.rb
decidim-participatory_processes-0.20.1 app/controllers/decidim/participatory_processes/admin/participatory_process_imports_controller.rb
decidim-participatory_processes-0.20.0 app/controllers/decidim/participatory_processes/admin/participatory_process_imports_controller.rb