Class: Locomotive::ContentEntryImportsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/locomotive/content_entry_imports_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



17
18
19
20
21
22
# File 'app/controllers/locomotive/content_entry_imports_controller.rb', line 17

def create
  authorize @content_type, :import?
  @import = Locomotive::ContentEntryImport.new(import_params)
  service.async_import(@import.file, @import.options) if @import.valid?
  respond_with @import, location: content_entry_import_path(current_site, @content_type.slug)
end

#destroyObject



24
25
26
27
28
29
30
# File 'app/controllers/locomotive/content_entry_imports_controller.rb', line 24

def destroy
  authorize @content_type, :import?
  message = t('flash.locomotive.content_entry_imports.destroy.notice')
  service.cancel(message)
  flash[:alert] = message
  redirect_to new_content_entry_import_path(current_site, @content_type.slug)
end

#newObject



12
13
14
15
# File 'app/controllers/locomotive/content_entry_imports_controller.rb', line 12

def new
  authorize @content_type, :import?
  @import = Locomotive::ContentEntryImport.new
end

#showObject



8
9
10
# File 'app/controllers/locomotive/content_entry_imports_controller.rb', line 8

def show
  authorize @content_type, :import?
end