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.



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

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

#createObject



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

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



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

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

#indexObject



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

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



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

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



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

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