Class: Hyrax::Dashboard::CollectionMembersController
Overview
Shows a list of all collections to the admins
Instance Method Summary
collapse
#batch, #batch=, #check_for_empty_batch?
configure_facets, #index
configure_facets, #index
Instance Method Details
#after_update ⇒ Object
10
11
12
13
14
15
|
# File 'app/controllers/hyrax/dashboard/collection_members_controller.rb', line 10
def after_update
respond_to do |format|
format.html { redirect_to success_return_path, notice: t('hyrax.dashboard.my.action.collection_update_success') }
format.json { render json: @collection, status: :updated, location: dashboard_collection_path(@collection) }
end
end
|
#after_update_error(err_msg) ⇒ Object
17
18
19
20
21
22
|
# File 'app/controllers/hyrax/dashboard/collection_members_controller.rb', line 17
def after_update_error(err_msg)
respond_to do |format|
format.html { redirect_to err_return_path, alert: err_msg }
format.json { render json: @collection.errors, status: :unprocessable_entity }
end
end
|
#update_members ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'app/controllers/hyrax/dashboard/collection_members_controller.rb', line 24
def update_members
err_msg = validate
after_update_error(err_msg) if err_msg.present?
return if err_msg.present?
collection.reindex_extent = Hyrax::Adapters::NestingIndexAdapter::LIMITED_REINDEX
members = collection.add_member_objects batch_ids
messages = members.collect { |member| member.errors.full_messages }.flatten
if messages.size == members.size
after_update_error(messages.uniq.join(', '))
elsif messages.present?
flash[:error] = messages.uniq.join(', ')
after_update
else
after_update
end
end
|