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.26.10 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.26.9 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.26.8 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.26.7 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.26.5 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.26.4 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.26.3 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.26.2 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.26.1 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.26.0 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.26.0.rc2 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.26.0.rc1 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.25.2 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.25.1 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.25.0 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.25.0.rc4 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.25.0.rc3 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.25.0.rc2 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.25.0.rc1 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.24.3 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb