Class: Hybridge::IngestController

Inherits:
Hyrax::MyController
  • Object
show all
Includes:
Hyrax::Breadcrumbs
Defined in:
app/controllers/hybridge/ingest_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



11
12
13
14
15
16
17
# File 'app/controllers/hybridge/ingest_controller.rb', line 11

def index
  add_breadcrumbs
  @packages = packages('csv')
  @processing = packages('processing', true)
  @processed = packages('processed', true)
  @collections = collections
end

#performObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/hybridge/ingest_controller.rb', line 19

def perform
  if params[:package_id].nil?
    flash[:error] = "Unable to find selected file in source directory. Please contact your System Administrator"
  else
    params[:package_id].each do | package |
      package_location = staged!(File.join(location, package))
      next if package_location.nil?
      collection_id = params[:collection_id][package]
      Hybridge::IngestPackageJob.perform_later(package_location, collection_id, current_user)
    end
    flash[:notice] = "Successfully started the ingest process. This can take awhile"
  end
  redirect_to hybridge.root_path
end