Module: Sufia::BatchEditsControllerBehavior

Extended by:
ActiveSupport::Concern
Includes:
Breadcrumbs
Included in:
BatchEditsController
Defined in:
app/controllers/concerns/sufia/batch_edits_controller_behavior.rb

Instance Method Summary collapse

Methods included from Breadcrumbs

#add_breadcrumb_for_action, #build_breadcrumbs, #default_trail, #trail_from_referer

Instance Method Details

#after_destroy_collectionObject



25
26
27
# File 'app/controllers/concerns/sufia/batch_edits_controller_behavior.rb', line 25

def after_destroy_collection
  redirect_to_return_controller unless request.xhr?
end

#after_updateObject



18
19
20
21
22
23
# File 'app/controllers/concerns/sufia/batch_edits_controller_behavior.rb', line 18

def after_update
  respond_to do |format|
    format.json { head :no_content }
    format.html { redirect_to_return_controller }
  end
end

#editObject



11
12
13
14
15
16
# File 'app/controllers/concerns/sufia/batch_edits_controller_behavior.rb', line 11

def edit
  super
  work = form_class.model_class.new
  work.depositor = current_user.user_key
  @form = form_class.new(work, current_user, batch)
end

#updateObject



35
36
37
38
39
40
41
42
# File 'app/controllers/concerns/sufia/batch_edits_controller_behavior.rb', line 35

def update
  case params["update_type"]
  when "update"
    super
  when "delete_all"
    destroy_batch
  end
end

#update_document(obj) ⇒ Object



29
30
31
32
33
# File 'app/controllers/concerns/sufia/batch_edits_controller_behavior.rb', line 29

def update_document(obj)
  obj.attributes = work_params
  obj.date_modified = Time.current.ctime
  obj.visibility = params[:visibility]
end