Sha256: 2351f203404a2819d74b675ac1466eccfb2711dbe3355cb23d83f07dc751aed9

Contents?: true

Size: 945 Bytes

Versions: 13

Compression:

Stored size: 945 Bytes

Contents

# frozen_string_literal: true

module Decidim
  module Assemblies
    module Admin
      class AssemblyImportsController < Decidim::Assemblies::Admin::ApplicationController
        layout "decidim/admin/assemblies_imports"

        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, current_user) 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

13 entries across 13 versions & 1 rubygems

Version Path
decidim-assemblies-0.29.1 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.28.4 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.29.0 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.28.3 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.29.0.rc4 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.29.0.rc3 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.29.0.rc2 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.29.0.rc1 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.28.2 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.28.1 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.28.0 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.28.0.rc5 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.28.0.rc4 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb