curation_concerns 1.0.0.beta7 → 1.0.0.beta8

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: 22cca2bceccfc06d12a86825fe10d8f27ecfc0b7
4
- data.tar.gz: 2cb151b95b0c2da91d3fcb2b0b54404e4d4ad1d1
3
+ metadata.gz: 2d831ace32b6cd1aacb1efdaf22ac5a9fcf69168
4
+ data.tar.gz: 8fc0d5456aa13666591e2939182b0c59257cc6db
5
5
  SHA512:
6
- metadata.gz: 080f23f93d1c098d0f15e3c1c6c416de18cf2f40894d8fb2b700e8a4e571b632d8c0a680b50fc72a6547336ad3aef527196c76c9eb65f66e72de57ea5be19538
7
- data.tar.gz: 99c4d8ee5bf8f9f6e7272cc45a54a114672e7371f64a3b108cfb1ad9bff90d3897a2619de52f58bb6274e03be48b22414d7678059f07aeceeea34d7d76d9d723
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] << '(' + (work_clauses + collection_clauses).join(' OR ') + ')'
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 blacklight_params.key?(:f) && Array.wrap(blacklight_params[:f][:generic_type_sim]).include?('Collection')
26
- work_types.map do |klass|
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 blacklight_params.key?(:f) && Array.wrap(blacklight_params[:f][:generic_type_sim]).include?('Work')
33
- [ActiveFedora::SolrQueryBuilder.construct_query_for_rel(has_model: ::Collection.to_class_uri)]
44
+ return [] if only_works?
45
+ [::Collection.to_class_uri]
34
46
  end
35
47
  end
36
48
  end
@@ -1,3 +1,3 @@
1
1
  module CurationConcerns
2
- VERSION = "1.0.0.beta7".freeze
2
+ VERSION = "1.0.0.beta8".freeze
3
3
  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} file_format_tesim #{contributor_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.beta7
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-02 00:00:00.000000000 Z
13
+ date: 2016-06-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: hydra-head