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
#add_breadcrumb_for_action, #add_breadcrumb_for_controller, #build_breadcrumbs, #default_trail, #trail_from_referer
Instance Method Details
#after_destroy_collection ⇒ Object
45
46
47
|
# File 'app/controllers/concerns/sufia/batch_edits_controller_behavior.rb', line 45
def after_destroy_collection
redirect_to_return_controller unless request.xhr?
end
|
#after_update ⇒ Object
37
38
39
40
41
42
43
|
# File 'app/controllers/concerns/sufia/batch_edits_controller_behavior.rb', line 37
def after_update
respond_to do |format|
format.json { head :no_content }
format.html { redirect_to_return_controller }
end
end
|
#edit ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'app/controllers/concerns/sufia/batch_edits_controller_behavior.rb', line 11
def edit
super
@generic_file = ::GenericFile.new
@generic_file.depositor = current_user.user_key
@terms = terms - [:title, :format, :resource_type]
h = {}
@names = []
permissions = []
batch.each do |doc_id|
gf = ::GenericFile.load_instance_from_solr(doc_id)
terms.each do |key|
h[key] ||= []
h[key] = (h[key] + gf.send(key)).uniq
end
@names << gf.to_s
permissions = (permissions + gf.permissions).uniq
end
initialize_fields(h, @generic_file)
@generic_file.permissions_attributes = [{type: 'group', name: 'public', access: 'read'}]
end
|
#update ⇒ Object
55
56
57
58
59
60
61
62
|
# File 'app/controllers/concerns/sufia/batch_edits_controller_behavior.rb', line 55
def update
case params["update_type"]
when "update"
super
when "delete_all"
destroy_batch
end
end
|
#update_document(obj) ⇒ Object
49
50
51
52
53
|
# File 'app/controllers/concerns/sufia/batch_edits_controller_behavior.rb', line 49
def update_document(obj)
obj.attributes = generic_file_params
obj.date_modified = Time.now.ctime
obj.visibility = params[:visibility]
end
|