Sha256: b99d9289e1ba1dc95b8a61e0b2d7dc3502d8a64dcac2099e5a535d639554df2d

Contents?: true

Size: 894 Bytes

Versions: 12

Compression:

Stored size: 894 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, 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

12 entries across 12 versions & 1 rubygems

Version Path
decidim-assemblies-0.27.9 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.27.8 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.27.7 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.27.6 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.27.5 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.27.4 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.27.3 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.27.2 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.27.1 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.27.0 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.27.0.rc2 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb
decidim-assemblies-0.27.0.rc1 app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb