Module: Sufia::TransfersControllerBehavior
- Extended by:
- ActiveSupport::Concern
- Included in:
- TransfersController
- Defined in:
- app/controllers/concerns/sufia/transfers_controller_behavior.rb
Instance Method Summary collapse
-
#accept ⇒ Object
Kicks of a job that completes the transfer.
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #reject ⇒ Object
Instance Method Details
#accept ⇒ Object
Kicks of a job that completes the transfer. If params is set, it will revoke any existing edit permissions on the work.
42 43 44 45 46 47 48 |
# File 'app/controllers/concerns/sufia/transfers_controller_behavior.rb', line 42 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 sufia.transfers_path, notice: "Transfer complete" end |
#create ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'app/controllers/concerns/sufia/transfers_controller_behavior.rb', line 26 def create @proxy_deposit_request.sending_user = current_user if @proxy_deposit_request.save redirect_to sufia.transfers_path, notice: "Transfer request created" else redirect_to root_url, alert: @proxy_deposit_request.errors..to_sentence end end |
#destroy ⇒ Object
55 56 57 58 |
# File 'app/controllers/concerns/sufia/transfers_controller_behavior.rb', line 55 def destroy @proxy_deposit_request.cancel! redirect_to sufia.transfers_path, notice: "Transfer canceled" end |
#index ⇒ Object
35 36 37 38 |
# File 'app/controllers/concerns/sufia/transfers_controller_behavior.rb', line 35 def index @incoming = ProxyDepositRequest.where(receiving_user_id: current_user.id).reject(&:deleted_work?) @outgoing = ProxyDepositRequest.where(sending_user_id: current_user.id) end |
#new ⇒ Object
22 23 24 |
# File 'app/controllers/concerns/sufia/transfers_controller_behavior.rb', line 22 def new @work = CurationConcerns::WorkRelation.new.find(params[:id]) end |
#reject ⇒ Object
50 51 52 53 |
# File 'app/controllers/concerns/sufia/transfers_controller_behavior.rb', line 50 def reject @proxy_deposit_request.reject! redirect_to sufia.transfers_path, notice: "Transfer rejected" end |