hydra-collections 1.3.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +0 -2
- data/app/controllers/concerns/hydra/collections_controller_behavior.rb +1 -6
- data/app/models/concerns/hydra/collection.rb +1 -2
- data/{lib/hydra/datastreams → app/models/datastreams/hydra}/collection_rdf_datastream.rb +0 -0
- data/lib/hydra-collections.rb +2 -2
- data/lib/hydra/collections/version.rb +1 -1
- data/spec/controllers/collections_controller_spec.rb +34 -10
- data/spec/controllers/other_collections_controller_spec.rb +13 -0
- data/spec/models/collection_spec.rb +11 -0
- metadata +4 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a40774a6709a3b08238ba531159fcdbc422c4999
|
|
4
|
+
data.tar.gz: 83c247f517fed9c0a105cc33d4dc40a128af35cb
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 31a88c9b6891ab76d58886b2453ac1ff4f2c8abb1282cbbc28a1c3147518320ab14d0ca77649600b1dec2d941250ff95c3a88712e43745f517f8720f13392755
|
|
7
|
+
data.tar.gz: dc8a6a6df5719248144cd00429fcd0b6afeb6f9aee6b9e2de3d8ab7ffd969386ebe69fcc7c149add42c6067797b018ce7f751e188e55d3e830e82b4fb28c5bab
|
data/Gemfile
CHANGED
|
@@ -3,8 +3,6 @@ source 'https://rubygems.org'
|
|
|
3
3
|
# Specify your gem's dependencies in hydra-collections.gemspec
|
|
4
4
|
gemspec
|
|
5
5
|
|
|
6
|
-
gem 'blacklight', github:'projectblacklight/blacklight' ,ref:'2eb87e73ee81ee701982ca32e5eca37429e3c199'
|
|
7
|
-
|
|
8
6
|
group :development, :test do
|
|
9
7
|
gem 'sqlite3'
|
|
10
8
|
gem "factory_girl_rails", "~> 4.1.0"
|
|
@@ -178,12 +178,7 @@ module Hydra
|
|
|
178
178
|
# include filters into the query to only include the collection memebers
|
|
179
179
|
def include_collection_ids(solr_parameters, user_parameters)
|
|
180
180
|
solr_parameters[:fq] ||= []
|
|
181
|
-
|
|
182
|
-
solr_parameters[:fq] << '{!lucene}-id:[* TO *]' # Don't match anything
|
|
183
|
-
else
|
|
184
|
-
query = @collection.member_ids.map{|id| 'id:"'+id+'"'}.join " OR "
|
|
185
|
-
solr_parameters[:fq] << query
|
|
186
|
-
end
|
|
181
|
+
solr_parameters[:fq] << Solrizer.solr_name(:collection)+':"'+@collection.id+'"'
|
|
187
182
|
end
|
|
188
183
|
end # module CollectionsControllerBehavior
|
|
189
184
|
end # module Hydra
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
require 'hydra/datastreams/collection_rdf_datastream'
|
|
2
1
|
|
|
3
2
|
module Hydra
|
|
4
3
|
module Collection
|
|
@@ -9,7 +8,7 @@ module Hydra
|
|
|
9
8
|
include Hydra::Collections::Collectible
|
|
10
9
|
|
|
11
10
|
included do
|
|
12
|
-
has_metadata "descMetadata", type: CollectionRdfDatastream
|
|
11
|
+
has_metadata "descMetadata", type: Hydra::CollectionRdfDatastream
|
|
13
12
|
has_metadata "properties", type: Hydra::Datastream::Properties
|
|
14
13
|
|
|
15
14
|
has_and_belongs_to_many :members, :property => :has_collection_member, :class_name => "ActiveFedora::Base" , :after_remove => :remove_member
|
|
File without changes
|
data/lib/hydra-collections.rb
CHANGED
|
@@ -224,7 +224,7 @@ describe CollectionsController do
|
|
|
224
224
|
@asset1 = GenericFile.create!(title: "First of the Assets")
|
|
225
225
|
@asset2 = GenericFile.create!(title: "Second of the Assets")
|
|
226
226
|
@asset3 = GenericFile.create!(title: "Third of the Assets")
|
|
227
|
-
@collection = Collection.new
|
|
227
|
+
@collection = Collection.new(pid:"abc:123")
|
|
228
228
|
@collection.title = "My collection"
|
|
229
229
|
@collection.apply_depositor_metadata(@user.user_key)
|
|
230
230
|
@collection.members = [@asset1,@asset2,@asset3]
|
|
@@ -240,15 +240,39 @@ describe CollectionsController do
|
|
|
240
240
|
ids.should include @asset2.pid
|
|
241
241
|
ids.should include @asset3.pid
|
|
242
242
|
end
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
243
|
+
describe "additional collections" do
|
|
244
|
+
before do
|
|
245
|
+
@asset4 = GenericFile.create!(title: "#{@asset1.id}")
|
|
246
|
+
@collection2 = Collection.new(pid:"abc:1234")
|
|
247
|
+
@collection2.title = "Other collection"
|
|
248
|
+
@collection2.apply_depositor_metadata(@user.user_key)
|
|
249
|
+
@collection2.members = [@asset4]
|
|
250
|
+
@collection2.save
|
|
251
|
+
@asset4 = @asset4.reload
|
|
252
|
+
@asset4.collections.should == [@collection2]
|
|
253
|
+
end
|
|
254
|
+
|
|
255
|
+
it "should show only the collections assets" do
|
|
256
|
+
get :show, id: @collection.pid
|
|
257
|
+
assigns[:collection].title.should == @collection.title
|
|
258
|
+
ids = assigns[:member_docs].map {|d| d.id}
|
|
259
|
+
ids.should include @asset1.pid
|
|
260
|
+
ids.should include @asset2.pid
|
|
261
|
+
ids.should include @asset3.pid
|
|
262
|
+
ids.should_not include @asset4.pid
|
|
263
|
+
|
|
264
|
+
end
|
|
265
|
+
it "should show only the other collections assets" do
|
|
266
|
+
|
|
267
|
+
get :show, id: @collection2.pid
|
|
268
|
+
assigns[:collection].title.should == @collection2.title
|
|
269
|
+
ids = assigns[:member_docs].map {|d| d.id}
|
|
270
|
+
ids.should_not include @asset1.pid
|
|
271
|
+
ids.should_not include @asset2.pid
|
|
272
|
+
ids.should_not include @asset3.pid
|
|
273
|
+
ids.should include @asset4.pid
|
|
274
|
+
|
|
275
|
+
end
|
|
252
276
|
end
|
|
253
277
|
|
|
254
278
|
it "when the collection is empty it should show no assets" do
|
|
@@ -13,11 +13,24 @@ end
|
|
|
13
13
|
class OtherCollection < ActiveFedora::Base
|
|
14
14
|
include Hydra::Collection
|
|
15
15
|
include Hydra::Collections::Collectible
|
|
16
|
+
|
|
17
|
+
def to_solr(solr_doc={}, opts={})
|
|
18
|
+
super(solr_doc, opts)
|
|
19
|
+
solr_doc = index_collection_pids(solr_doc)
|
|
20
|
+
return solr_doc
|
|
21
|
+
end
|
|
22
|
+
|
|
16
23
|
end
|
|
17
24
|
class Member < ActiveFedora::Base
|
|
18
25
|
include Hydra::Collections::Collectible
|
|
19
26
|
attr_accessor :title
|
|
20
27
|
|
|
28
|
+
def to_solr(solr_doc={}, opts={})
|
|
29
|
+
super(solr_doc, opts)
|
|
30
|
+
solr_doc = index_collection_pids(solr_doc)
|
|
31
|
+
return solr_doc
|
|
32
|
+
end
|
|
33
|
+
|
|
21
34
|
end
|
|
22
35
|
|
|
23
36
|
# make sure a collection by another name still assigns the @collection variable
|
|
@@ -18,6 +18,14 @@ describe Collection do
|
|
|
18
18
|
before(:all) do
|
|
19
19
|
@user = FactoryGirl.find_or_create(:user)
|
|
20
20
|
class GenericFile < ActiveFedora::Base
|
|
21
|
+
include Hydra::Collections::Collectible
|
|
22
|
+
|
|
23
|
+
def to_solr(solr_doc={}, opts={})
|
|
24
|
+
super(solr_doc, opts)
|
|
25
|
+
solr_doc = index_collection_pids(solr_doc)
|
|
26
|
+
return solr_doc
|
|
27
|
+
end
|
|
28
|
+
|
|
21
29
|
end
|
|
22
30
|
end
|
|
23
31
|
after(:all) do
|
|
@@ -73,6 +81,9 @@ describe Collection do
|
|
|
73
81
|
@collection.members = [@gf1]
|
|
74
82
|
@collection.save
|
|
75
83
|
@collection.date_modified.should == modified_date
|
|
84
|
+
@gf1 = @gf1.reload
|
|
85
|
+
@gf1.collections.should include(@collection)
|
|
86
|
+
@gf1.to_solr[Solrizer.solr_name(:collection)].should == [@collection.id]
|
|
76
87
|
end
|
|
77
88
|
it "should have a title" do
|
|
78
89
|
@collection.title = "title"
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hydra-collections
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.3.
|
|
4
|
+
version: 1.3.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Carolyn Cole
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2013-
|
|
11
|
+
date: 2013-11-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: blacklight
|
|
@@ -142,6 +142,7 @@ files:
|
|
|
142
142
|
- app/helpers/collections_search_helper.rb
|
|
143
143
|
- app/models/collection.rb
|
|
144
144
|
- app/models/concerns/hydra/collection.rb
|
|
145
|
+
- app/models/datastreams/hydra/collection_rdf_datastream.rb
|
|
145
146
|
- app/models/solr_document.rb
|
|
146
147
|
- app/views/batch_select/_add_button.html.erb
|
|
147
148
|
- app/views/batch_select/_check_all.html.erb
|
|
@@ -175,7 +176,6 @@ files:
|
|
|
175
176
|
- lib/hydra/collections/selects_collections.rb
|
|
176
177
|
- lib/hydra/collections/solr_document_behavior.rb
|
|
177
178
|
- lib/hydra/collections/version.rb
|
|
178
|
-
- lib/hydra/datastreams/collection_rdf_datastream.rb
|
|
179
179
|
- solr_conf/conf/schema.xml
|
|
180
180
|
- solr_conf/conf/solrconfig.xml
|
|
181
181
|
- solr_conf/solr.xml
|
|
@@ -223,7 +223,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
223
223
|
version: '0'
|
|
224
224
|
requirements: []
|
|
225
225
|
rubyforge_project:
|
|
226
|
-
rubygems_version: 2.0.
|
|
226
|
+
rubygems_version: 2.0.7
|
|
227
227
|
signing_key:
|
|
228
228
|
specification_version: 4
|
|
229
229
|
summary: A rails engine for managing Hydra Collections
|
|
@@ -250,4 +250,3 @@ test_files:
|
|
|
250
250
|
- spec/support/db/migrate/20111101221803_create_searches.rb
|
|
251
251
|
- spec/support/lib/generators/test_app_generator.rb
|
|
252
252
|
- spec/support/lib/tasks/rspec.rake
|
|
253
|
-
has_rdoc:
|