Class: Hyrax::TransfersController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/hyrax/transfers_controller.rb

Instance Method Summary collapse

Instance Method Details

#acceptObject

Kicks of a job that completes the transfer. If params is set, it will revoke any existing edit permissions on the work.


48
49
50
51
52
# File 'app/controllers/hyrax/transfers_controller.rb', line 48

def accept
  @proxy_deposit_request.transfer!(params[:reset])
  current_user.can_receive_deposits_from << @proxy_deposit_request.sending_user if params[:sticky]
  redirect_to hyrax.transfers_path, notice: "Transfer complete"
end

#createObject


29
30
31
32
33
34
35
36
37
# File 'app/controllers/hyrax/transfers_controller.rb', line 29

def create
  @proxy_deposit_request.sending_user = current_user
  if @proxy_deposit_request.save
    redirect_to hyrax.transfers_path, notice: "Transfer request created"
  else
    @work = Hyrax::WorkRelation.new.find(params[:id])
    render :new
  end
end

#destroyObject


59
60
61
62
# File 'app/controllers/hyrax/transfers_controller.rb', line 59

def destroy
  @proxy_deposit_request.cancel!
  redirect_to hyrax.transfers_path, notice: "Transfer canceled"
end

#indexObject


39
40
41
42
43
44
# File 'app/controllers/hyrax/transfers_controller.rb', line 39

def index
  add_breadcrumb t(:'hyrax.controls.home'), root_path
  add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
  add_breadcrumb t(:'hyrax.admin.sidebar.transfers'), hyrax.transfers_path
  @presenter = TransfersPresenter.new(current_user, view_context)
end

#newObject


22
23
24
25
26
27
# File 'app/controllers/hyrax/transfers_controller.rb', line 22

def new
  add_breadcrumb t(:'hyrax.controls.home'), root_path
  add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path
  add_breadcrumb t(:'hyrax.transfers.new.header'), hyrax.new_work_transfer_path
  @work = Hyrax::WorkRelation.new.find(params[:id])
end

#rejectObject


54
55
56
57
# File 'app/controllers/hyrax/transfers_controller.rb', line 54

def reject
  @proxy_deposit_request.reject!
  redirect_to hyrax.transfers_path, notice: "Transfer rejected"
end