curation_concerns 1.0.0.beta7 → 1.0.0.beta8
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/app/forms/curation_concerns/forms/collection_edit_form.rb +2 -0
- data/app/search_builders/curation_concerns/filter_by_type.rb +19 -7
- data/lib/curation_concerns/version.rb +1 -1
- data/lib/generators/curation_concerns/templates/catalog_controller.rb +1 -2
- data/spec/features/collection_spec.rb +11 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2d831ace32b6cd1aacb1efdaf22ac5a9fcf69168
|
4
|
+
data.tar.gz: 8fc0d5456aa13666591e2939182b0c59257cc6db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fdcb4b58d985603b5181365d90e944506b94971849009c4d2539af81215f02647a221d61ac21e27b0f2c84ffa57ceb233b58652e69e062b5f7135f8a7760583
|
7
|
+
data.tar.gz: 0b120bb5c099ed53c352b533728e088e6dced3b95b08cf2bb57770344415fb46f20b153329c9d5f9a03f4020dcb3320da41857a737c1e8e3a0953f732b11b376
|
@@ -11,6 +11,8 @@ module CurationConcerns
|
|
11
11
|
:representative_id, :thumbnail_id, :identifier, :based_near,
|
12
12
|
:related_url, :visibility]
|
13
13
|
|
14
|
+
self.required_fields = [:title]
|
15
|
+
|
14
16
|
# Test to see if the given field is required
|
15
17
|
# @param [Symbol] key a field
|
16
18
|
# @return [Boolean] is it required or not
|
@@ -9,11 +9,25 @@ module CurationConcerns
|
|
9
9
|
# Add queries that excludes everything except for works and collections
|
10
10
|
def filter_models(solr_parameters)
|
11
11
|
solr_parameters[:fq] ||= []
|
12
|
-
solr_parameters[:fq] << '
|
12
|
+
solr_parameters[:fq] << '{!terms f=has_model_ssim}' + (work_clauses + collection_clauses).join(',')
|
13
13
|
end
|
14
14
|
|
15
|
+
protected
|
16
|
+
|
17
|
+
def only_collections?
|
18
|
+
generic_type_field.include?('Collection')
|
19
|
+
end
|
20
|
+
|
21
|
+
def only_works?
|
22
|
+
generic_type_field.include?('Work')
|
23
|
+
end
|
24
|
+
|
15
25
|
private
|
16
26
|
|
27
|
+
def generic_type_field
|
28
|
+
Array.wrap(blacklight_params.fetch(:f, {}).fetch(:generic_type_sim, []))
|
29
|
+
end
|
30
|
+
|
17
31
|
# Override this method if you want to limit some of the registered
|
18
32
|
# types from appearing in search results
|
19
33
|
# @returns [Array<Class>] the list of work types to include in searches
|
@@ -22,15 +36,13 @@ module CurationConcerns
|
|
22
36
|
end
|
23
37
|
|
24
38
|
def work_clauses
|
25
|
-
return [] if
|
26
|
-
work_types.map
|
27
|
-
ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: klass.to_class_uri)
|
28
|
-
end
|
39
|
+
return [] if only_collections?
|
40
|
+
work_types.map(&:to_class_uri)
|
29
41
|
end
|
30
42
|
|
31
43
|
def collection_clauses
|
32
|
-
return [] if
|
33
|
-
[
|
44
|
+
return [] if only_works?
|
45
|
+
[::Collection.to_class_uri]
|
34
46
|
end
|
35
47
|
end
|
36
48
|
end
|
@@ -30,7 +30,6 @@ class CatalogController < ApplicationController
|
|
30
30
|
config.add_facet_field solr_name('language', :facetable), limit: 5
|
31
31
|
config.add_facet_field solr_name('based_near', :facetable), limit: 5
|
32
32
|
config.add_facet_field solr_name('publisher', :facetable), limit: 5
|
33
|
-
config.add_facet_field solr_name('file_format', :facetable), limit: 5
|
34
33
|
config.add_facet_field 'generic_type_sim', show: false, single: true
|
35
34
|
|
36
35
|
# Have BL send all facet field names to Solr, which has been the default
|
@@ -78,7 +77,7 @@ class CatalogController < ApplicationController
|
|
78
77
|
label_name = solr_name('title', :stored_searchable, type: :string)
|
79
78
|
contributor_name = solr_name('contributor', :stored_searchable, type: :string)
|
80
79
|
field.solr_parameters = {
|
81
|
-
qf: "#{title_name} #{label_name}
|
80
|
+
qf: "#{title_name} #{label_name} #{contributor_name}",
|
82
81
|
pf: title_name.to_s
|
83
82
|
}
|
84
83
|
end
|
@@ -17,6 +17,17 @@ feature 'collection' do
|
|
17
17
|
Collection.destroy_all
|
18
18
|
end
|
19
19
|
|
20
|
+
describe 'collection creation fields' do
|
21
|
+
before do
|
22
|
+
sign_in user
|
23
|
+
visit '/collections/new'
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'visibly marks the title field as required' do
|
27
|
+
expect(page).to have_content 'Title required'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
20
31
|
describe 'create collection' do
|
21
32
|
before do
|
22
33
|
sign_in 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.
|
4
|
+
version: 1.0.0.beta8
|
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-
|
13
|
+
date: 2016-06-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: hydra-head
|