curation_concerns 1.0.0.beta10 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72fb3bda363615458c1b666279bbb701ddaa976a
4
- data.tar.gz: b30167b1ee83c064362de2146dee265a46044ab0
3
+ metadata.gz: 7eb8f7385740c5fbbc0735eba71e83175368a313
4
+ data.tar.gz: d0715c82e683b32154dba32111d02b31e9101af6
5
5
  SHA512:
6
- metadata.gz: ab627a66094df0e588350f40d060fe6752de190af34efcd5df2771e85c50808986e8f5f69cd837a00c2d19f60bb35c658871463b865c28f373ad3c817794a76e
7
- data.tar.gz: 69e0fc0c3854ed43ff8d494db1698610e03b92050702d794576c98321fb2aa0347b59e1d22e6a3f9198e571c6fb4ecfb7d387308fbcc86b9379bce4b4f873244
6
+ metadata.gz: 25e1d462f3f5db545779bd0a03a458ae4ad1f7b961163bb50d55a8a7537e70cbc343db5b9a26ea4c17dcaa8937266e41fc094b48b6fe7f7885b406db540e1e9b
7
+ data.tar.gz: 82f824c0adddcb8f722eb41a85876fea18c5e0b3045c1282ebd73eb176776303b1f7ce37fa59c1d4727ab7d9e152db3beb8df5d889503aa89e139a2c5bcc5856
@@ -24,6 +24,15 @@ module CurationConcerns
24
24
  def update(attributes)
25
25
  actor.update(attributes.with_indifferent_access)
26
26
  end
27
+
28
+ def destroy
29
+ curation_concern.in_collection_ids.each do |id|
30
+ destination_collection = ::Collection.find(id)
31
+ destination_collection.members.delete(curation_concern)
32
+ destination_collection.update_index
33
+ end
34
+ curation_concern.destroy
35
+ end
27
36
  end
28
37
  end
29
38
  end
@@ -95,9 +95,10 @@ module CurationConcerns::CurationConcernController
95
95
 
96
96
  def destroy
97
97
  title = curation_concern.to_s
98
- curation_concern.destroy
99
- CurationConcerns.config.callback.run(:after_destroy, curation_concern.id, current_user)
100
- after_destroy_response(title)
98
+ if actor.destroy
99
+ CurationConcerns.config.callback.run(:after_destroy, curation_concern.id, current_user)
100
+ after_destroy_response(title)
101
+ end
101
102
  end
102
103
 
103
104
  def file_manager
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency 'hydra-head', '>= 10.0.0.beta1', '< 11'
21
+ spec.add_dependency 'hydra-head', '>= 10.0.0', '< 11'
22
22
  spec.add_dependency 'blacklight', '~> 6.1'
23
23
  spec.add_dependency "breadcrumbs_on_rails", "~> 2.3"
24
24
  spec.add_dependency "jquery-ui-rails"
@@ -1,3 +1,3 @@
1
1
  module CurationConcerns
2
- VERSION = "1.0.0.beta10".freeze
2
+ VERSION = "1.0.0".freeze
3
3
  end
@@ -235,6 +235,7 @@ describe CurationConcerns::GenericWorksController do
235
235
 
236
236
  describe '#destroy' do
237
237
  let(:work_to_be_deleted) { create(:private_generic_work, user: user) }
238
+ let(:parent_collection) { create(:collection) }
238
239
 
239
240
  it 'deletes the work' do
240
241
  delete :destroy, id: work_to_be_deleted
@@ -242,6 +243,19 @@ describe CurationConcerns::GenericWorksController do
242
243
  expect(GenericWork).not_to exist(work_to_be_deleted.id)
243
244
  end
244
245
 
246
+ context "when work is a member of a collection" do
247
+ before do
248
+ parent_collection.members = [work_to_be_deleted]
249
+ parent_collection.save!
250
+ end
251
+ it 'deletes the work and updates the parent collection' do
252
+ delete :destroy, id: work_to_be_deleted
253
+ expect(GenericWork).not_to exist(work_to_be_deleted.id)
254
+ expect(response).to redirect_to main_app.search_catalog_path
255
+ expect(parent_collection.reload.members).to eq []
256
+ end
257
+ end
258
+
245
259
  it "invokes the after_destroy callback" do
246
260
  expect(CurationConcerns.config.callback).to receive(:run)
247
261
  .with(:after_destroy, work_to_be_deleted.id, user)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: curation_concerns
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta10
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Zumwalt
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-06-16 00:00:00.000000000 Z
13
+ date: 2016-06-22 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hydra-head
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ">="
20
20
  - !ruby/object:Gem::Version
21
- version: 10.0.0.beta1
21
+ version: 10.0.0
22
22
  - - "<"
23
23
  - !ruby/object:Gem::Version
24
24
  version: '11'
@@ -28,7 +28,7 @@ dependencies:
28
28
  requirements:
29
29
  - - ">="
30
30
  - !ruby/object:Gem::Version
31
- version: 10.0.0.beta1
31
+ version: 10.0.0
32
32
  - - "<"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '11'
@@ -1241,9 +1241,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
1241
1241
  version: '0'
1242
1242
  required_rubygems_version: !ruby/object:Gem::Requirement
1243
1243
  requirements:
1244
- - - ">"
1244
+ - - ">="
1245
1245
  - !ruby/object:Gem::Version
1246
- version: 1.3.1
1246
+ version: '0'
1247
1247
  requirements: []
1248
1248
  rubyforge_project:
1249
1249
  rubygems_version: 2.5.1