Sha256: bd6332384730c510aa0bea063a29d5c3c695430bf5d5642b0196a45d426d1d52

Contents?: true

Size: 880 Bytes

Versions: 33

Compression:

Stored size: 880 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Assemblies
    module Admin
      class AssemblyImportsController < Decidim::Assemblies::Admin::ApplicationController
        def new
          enforce_permission_to :import, :assembly
          @form = form(AssemblyImportForm).instance
        end

        def create
          enforce_permission_to :import, :assembly
          @form = form(AssemblyImportForm).from_params(params)

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

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

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
decidim-assemblies-0.23.6 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.24.2 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.23.5 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.24.1 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.24.0 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.24.0.rc2 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.23.4 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.24.0.rc1 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.23.3 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.23.2 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.23.1 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.23.1.rc1 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.23.0 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb