blacklight-spotlight 3.0.3 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +2 -2
  3. data/app/assets/javascripts/spotlight/admin/blocks/block.js +4 -0
  4. data/app/assets/stylesheets/spotlight/_breadcrumbs.scss +2 -4
  5. data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +2 -2
  6. data/app/controllers/concerns/spotlight/controller.rb +13 -12
  7. data/app/controllers/spotlight/attachments_controller.rb +1 -1
  8. data/app/controllers/spotlight/custom_search_fields_controller.rb +1 -1
  9. data/app/controllers/spotlight/pages_controller.rb +2 -6
  10. data/app/controllers/spotlight/searches_controller.rb +6 -1
  11. data/app/helpers/spotlight/application_helper.rb +1 -1
  12. data/app/helpers/spotlight/job_trackers_helper.rb +1 -1
  13. data/app/helpers/spotlight/main_app_helpers.rb +1 -1
  14. data/app/jobs/spotlight/reindex_exhibit_job.rb +9 -1
  15. data/app/mailers/spotlight/confirmation_mailer.rb +2 -1
  16. data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +2 -2
  17. data/app/models/spotlight/contact_email.rb +1 -1
  18. data/app/models/spotlight/page.rb +8 -0
  19. data/app/models/spotlight/page_configurations.rb +1 -1
  20. data/app/services/spotlight/exhibit_import_export_service.rb +1 -1
  21. data/app/views/layouts/spotlight/base.html.erb +5 -2
  22. data/app/views/shared/_body_preamble.html.erb +0 -0
  23. data/app/views/shared/_footer.html.erb +0 -1
  24. data/app/views/shared/_masthead.html.erb +1 -1
  25. data/app/views/shared/_user_util_links.html.erb +8 -2
  26. data/app/views/spotlight/catalog/admin.html.erb +1 -1
  27. data/app/views/spotlight/confirmation_mailer/confirmation_instructions.html.erb +3 -3
  28. data/app/views/spotlight/exhibits/_import.html.erb +1 -1
  29. data/app/views/spotlight/exhibits/_languages.html.erb +2 -2
  30. data/app/views/spotlight/filters/_form.html.erb +1 -1
  31. data/app/views/spotlight/resources/upload/_form.html.erb +1 -1
  32. data/app/views/spotlight/search_configurations/_document_index_view_types.html.erb +1 -1
  33. data/app/views/spotlight/search_configurations/_facet_metadata.html.erb +4 -2
  34. data/app/views/spotlight/search_configurations/_facets.html.erb +1 -1
  35. data/app/views/spotlight/searches/_form.html.erb +1 -1
  36. data/app/views/spotlight/sir_trevor/blocks/_iframe_block.html.erb +1 -1
  37. data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +1 -0
  38. data/app/views/spotlight/translations/_browse_categories.html.erb +1 -1
  39. data/app/views/spotlight/translations/_groups.html.erb +1 -1
  40. data/app/views/spotlight/translations/_import.html.erb +1 -1
  41. data/app/views/spotlight/translations/_metadata.html.erb +1 -1
  42. data/app/views/spotlight/translations/_search_fields.html.erb +1 -1
  43. data/config/i18n-tasks.yml +1 -1
  44. data/config/locales/spotlight.en.yml +13 -4
  45. data/lib/generators/spotlight/install_generator.rb +16 -7
  46. data/lib/generators/spotlight/templates/config/initializers/translation.rb +13 -11
  47. data/lib/spotlight/engine.rb +3 -1
  48. data/lib/spotlight/version.rb +1 -1
  49. data/lib/tasks/spotlight_tasks.rake +21 -3
  50. data/spec/examples.txt +1508 -1496
  51. data/spec/features/edit_search_fields_spec.rb +1 -1
  52. data/spec/features/javascript/blocks/solr_documents_block_spec.rb +2 -0
  53. data/spec/features/report_a_problem_spec.rb +1 -0
  54. data/spec/fixtures/iiif_responses.rb +81 -81
  55. data/spec/helpers/spotlight/pages_helper_spec.rb +1 -1
  56. data/spec/models/sir_trevor_rails/blocks/featured_pages_block_spec.rb +19 -1
  57. data/spec/models/solr_document_spec.rb +3 -3
  58. data/spec/models/spotlight/page_configurations_spec.rb +2 -2
  59. data/spec/models/spotlight/page_spec.rb +1 -1
  60. data/spec/spec_helper.rb +1 -1
  61. data/spec/test_app_templates/catalog_controller.rb +3 -4
  62. data/spec/views/spotlight/pages/show.html.erb_spec.rb +17 -6
  63. data/spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb +27 -1
  64. data/spec/views/spotlight/tags/index.html.erb_spec.rb +0 -1
  65. metadata +14 -9
  66. data/spec/views/shared/_footer.html.erb_spec.rb +0 -15
@@ -23,7 +23,7 @@ describe 'Search Administration', type: :feature do
23
23
  within("[data-id='genre_ssim']") do
24
24
  expect(page).to have_content('Genre')
25
25
  expect(page).to have_content(/\d+ items/)
26
- expect(page).to have_content(/(\d+) unique values/)
26
+ expect(page).to have_content(/([\d+]+) unique values/)
27
27
  end
28
28
  end
29
29
 
@@ -140,6 +140,8 @@ describe 'Solr Document Block', feature: true, versioning: true, default_max_wai
140
140
  end
141
141
 
142
142
  it 'allows you to optionally display a ZPR link with the image', js: true do
143
+ skip('Passes locally, but soooo flakey on Travis.') if ENV['CI']
144
+
143
145
  fill_in_solr_document_block_typeahead_field with: 'gk446cj2442'
144
146
 
145
147
  check 'Offer "View larger" option'
@@ -28,6 +28,7 @@ describe 'Report a Problem', type: :feature do
28
28
  click_on 'Feedback'
29
29
 
30
30
  expect(page).to have_css('h2', text: 'Contact us', visible: true)
31
+ expect(page).to have_css('#contact_form_name', count: 1)
31
32
  end
32
33
 
33
34
  it 'accepts a problem report', js: true do
@@ -5,24 +5,24 @@ module IiifResponses
5
5
  {
6
6
  "@id": 'uri://for-top-level-collection',
7
7
  "@type": 'sc:Collection',
8
- "label": 'Complex Collection',
9
- "collections": [
8
+ label: 'Complex Collection',
9
+ collections: [
10
10
  {
11
11
  "@id": 'uri://for-child-collection1',
12
12
  "@type": 'sc:Collection',
13
- "label": 'Child Collection 1'
13
+ label: 'Child Collection 1'
14
14
  },
15
15
  {
16
16
  "@id": 'uri://for-child-collection2',
17
17
  "@type": 'sc:Collection',
18
- "label": 'Child Collection 2'
18
+ label: 'Child Collection 2'
19
19
  }
20
20
  ],
21
- "manifests": [
21
+ manifests: [
22
22
  {
23
23
  "@id": 'uri://for-manifest1',
24
24
  "@type": 'sc:Manifest',
25
- "label": 'Test Manifest 1'
25
+ label: 'Test Manifest 1'
26
26
  }
27
27
  ]
28
28
  }.to_json
@@ -32,19 +32,19 @@ module IiifResponses
32
32
  {
33
33
  "@id": 'uri://for-child-collection1',
34
34
  "@type": 'sc:Collection',
35
- "label": 'Child Collection 1',
36
- "collections": [
35
+ label: 'Child Collection 1',
36
+ collections: [
37
37
  {
38
38
  "@id": 'uri://for-child-collection3',
39
39
  "@type": 'sc:Collection',
40
- "label": 'Child Collection 3'
40
+ label: 'Child Collection 3'
41
41
  }
42
42
  ],
43
- "manifests": [
43
+ manifests: [
44
44
  {
45
45
  "@id": 'uri://for-manifest2',
46
46
  "@type": 'sc:Manifest',
47
- "label": 'Test Manifest 2'
47
+ label: 'Test Manifest 2'
48
48
  }
49
49
  ]
50
50
  }.to_json
@@ -54,12 +54,12 @@ module IiifResponses
54
54
  {
55
55
  "@id": 'uri://for-child-collection2',
56
56
  "@type": 'sc:Collection',
57
- "label": 'Child Collection 2',
58
- "manifests": [
57
+ label: 'Child Collection 2',
58
+ manifests: [
59
59
  {
60
60
  "@id": 'uri://for-manifest4',
61
61
  "@type": 'sc:Manifest',
62
- "label": 'Test Manifest 4'
62
+ label: 'Test Manifest 4'
63
63
  }
64
64
  ]
65
65
  }.to_json
@@ -69,12 +69,12 @@ module IiifResponses
69
69
  {
70
70
  "@id": 'uri://for-child-collection3',
71
71
  "@type": 'sc:Collection',
72
- "label": 'Child Collection 3',
73
- "manifests": [
72
+ label: 'Child Collection 3',
73
+ manifests: [
74
74
  {
75
75
  "@id": 'uri://for-manifest3',
76
76
  "@type": 'sc:Manifest',
77
- "label": 'Test Manifest 3'
77
+ label: 'Test Manifest 3'
78
78
  }
79
79
  ]
80
80
  }.to_json
@@ -84,40 +84,40 @@ module IiifResponses
84
84
  {
85
85
  "@id": 'uri://for-manifest1',
86
86
  "@type": 'sc:Manifest',
87
- "label": 'Test Manifest 1',
88
- "attribution": 'Attribution Data',
89
- "description": 'A test IIIF manifest',
90
- "license": 'http://www.example.org/license.html',
91
- "metadata": [
87
+ label: 'Test Manifest 1',
88
+ attribution: 'Attribution Data',
89
+ description: 'A test IIIF manifest',
90
+ license: 'http://www.example.org/license.html',
91
+ metadata: [
92
92
  {
93
- "label": 'Author',
94
- "value": 'John Doe'
93
+ label: 'Author',
94
+ value: 'John Doe'
95
95
  },
96
96
  {
97
- "label": 'Author',
98
- "value": 'Jane Doe'
97
+ label: 'Author',
98
+ value: 'Jane Doe'
99
99
  },
100
100
  {
101
- "label": 'Another Field',
102
- "value": 'Some data'
101
+ label: 'Another Field',
102
+ value: 'Some data'
103
103
  }
104
104
  ],
105
- "thumbnail": {
105
+ thumbnail: {
106
106
  "@id": 'uri://to-thumbnail'
107
107
  },
108
- "sequences": [
108
+ sequences: [
109
109
  {
110
110
  "@type": 'sc:Sequence',
111
- "canvases": [
111
+ canvases: [
112
112
  {
113
113
  "@type": 'sc:Canvas',
114
- "images": [
114
+ images: [
115
115
  {
116
116
  "@type": 'oa:Annotation',
117
- "resource": {
117
+ resource: {
118
118
  "@type": 'dcterms:Image',
119
119
  "@id": 'uri://full-image',
120
- "service": {
120
+ service: {
121
121
  "@id": 'uri://to-image-service'
122
122
  }
123
123
  }
@@ -134,47 +134,47 @@ module IiifResponses
134
134
  {
135
135
  "@id": 'uri://for-manifest2',
136
136
  "@type": 'sc:Manifest',
137
- "label": {
137
+ label: {
138
138
  "@value": 'Test Manifest 2',
139
139
  "@language": 'en'
140
140
  },
141
- "attribution": 'Attribution Data',
142
- "description": 'A test IIIF manifest',
143
- "license": 'http://www.example.org/license.html',
144
- "metadata": [
141
+ attribution: 'Attribution Data',
142
+ description: 'A test IIIF manifest',
143
+ license: 'http://www.example.org/license.html',
144
+ metadata: [
145
145
  {
146
- "label": 'Contributor',
147
- "value": 'John Doe'
146
+ label: 'Contributor',
147
+ value: 'John Doe'
148
148
  },
149
149
  {
150
- "label": 'Yet Another Field',
151
- "value": 'Some data'
150
+ label: 'Yet Another Field',
151
+ value: 'Some data'
152
152
  }
153
153
  ],
154
- "thumbnail": {
154
+ thumbnail: {
155
155
  "@id": 'uri://to-thumbnail'
156
156
  },
157
- "sequences": [
157
+ sequences: [
158
158
  {
159
159
  "@type": 'sc:Sequence',
160
- "canvases": [
160
+ canvases: [
161
161
  {
162
162
  "@type": 'sc:Canvas',
163
- "images": [
163
+ images: [
164
164
  {
165
165
  "@type": 'oa:Annotation',
166
- "resource": {
166
+ resource: {
167
167
  "@type": 'dcterms:Image',
168
- "service": {
168
+ service: {
169
169
  "@id": 'uri://to-image-service'
170
170
  }
171
171
  }
172
172
  },
173
173
  {
174
174
  "@type": 'oa:Annotation',
175
- "resource": {
175
+ resource: {
176
176
  "@type": 'dcterms:Image',
177
- "service": {
177
+ service: {
178
178
  "@id": 'uri://to-image-service2'
179
179
  }
180
180
  }
@@ -191,7 +191,7 @@ module IiifResponses
191
191
  {
192
192
  "@id": 'uri://for-manifest3',
193
193
  "@type": 'sc:Manifest',
194
- "label": [
194
+ label: [
195
195
  {
196
196
  "@value": 'Test Manifest 3',
197
197
  "@language": 'en'
@@ -201,34 +201,34 @@ module IiifResponses
201
201
  "@language": 'fr'
202
202
  }
203
203
  ],
204
- "attribution": 'Attribution Data',
205
- "description": 'A test IIIF manifest',
206
- "license": 'http://www.example.org/license.html',
207
- "metadata": [
204
+ attribution: 'Attribution Data',
205
+ description: 'A test IIIF manifest',
206
+ license: 'http://www.example.org/license.html',
207
+ metadata: [
208
208
  {
209
- "label": 'Author',
210
- "value": 'Jane Doe'
209
+ label: 'Author',
210
+ value: 'Jane Doe'
211
211
  },
212
212
  {
213
- "label": 'Collection',
214
- "value": 'Some Collection'
213
+ label: 'Collection',
214
+ value: 'Some Collection'
215
215
  }
216
216
  ],
217
- "thumbnail": {
217
+ thumbnail: {
218
218
  "@id": 'uri://to-thumbnail'
219
219
  },
220
- "sequences": [
220
+ sequences: [
221
221
  {
222
222
  "@type": 'sc:Sequence',
223
- "canvases": [
223
+ canvases: [
224
224
  {
225
225
  "@type": 'sc:Canvas',
226
- "images": [
226
+ images: [
227
227
  {
228
228
  "@type": 'oa:Annotation',
229
- "resource": {
229
+ resource: {
230
230
  "@type": 'dcterms:Image',
231
- "service": {
231
+ service: {
232
232
  "@id": 'uri://to-image-service'
233
233
  }
234
234
  }
@@ -245,35 +245,35 @@ module IiifResponses
245
245
  {
246
246
  "@id": 'uri://for-manifest4',
247
247
  "@type": 'sc:Manifest',
248
- "label": 'Test Manifest 4',
249
- "attribution": 'Attribution Data',
250
- "description": 'A test IIIF manifest',
251
- "license": 'http://www.example.org/license.html',
252
- "metadata": [
248
+ label: 'Test Manifest 4',
249
+ attribution: 'Attribution Data',
250
+ description: 'A test IIIF manifest',
251
+ license: 'http://www.example.org/license.html',
252
+ metadata: [
253
253
  {
254
- "label": 'Contributor',
255
- "value": 'Jane Doe'
254
+ label: 'Contributor',
255
+ value: 'Jane Doe'
256
256
  },
257
257
  {
258
- "label": 'Location',
259
- "value": 'Some location'
258
+ label: 'Location',
259
+ value: 'Some location'
260
260
  }
261
261
  ],
262
- "thumbnail": {
262
+ thumbnail: {
263
263
  "@id": 'uri://to-thumbnail'
264
264
  },
265
- "sequences": [
265
+ sequences: [
266
266
  {
267
267
  "@type": 'sc:Sequence',
268
- "canvases": [
268
+ canvases: [
269
269
  {
270
270
  "@type": 'sc:Canvas',
271
- "images": [
271
+ images: [
272
272
  {
273
273
  "@type": 'oa:Annotation',
274
- "resource": {
274
+ resource: {
275
275
  "@type": 'dcterms:Image',
276
- "service": {
276
+ service: {
277
277
  "@id": 'uri://to-image-service'
278
278
  }
279
279
  }
@@ -46,7 +46,7 @@ describe Spotlight::PagesHelper, type: :helper do
46
46
  let(:search_result) { [double('response'), double('documents')] }
47
47
 
48
48
  it 'returns the results for a given search browse category' do
49
- expect(helper).to receive(:search_results).with('q' => 'query').and_return(search_result)
49
+ expect(helper).to receive(:search_results).with({ 'q' => 'query' }).and_return(search_result)
50
50
  expect(helper.get_search_widget_search_results(good)).to eq search_result
51
51
  end
52
52
 
@@ -3,7 +3,8 @@
3
3
  describe SirTrevorRails::Blocks::FeaturedPagesBlock do
4
4
  subject { described_class.new({ type: '', data: block_data }, page) }
5
5
 
6
- let(:page) { FactoryBot.create(:feature_page) }
6
+ let(:page) { FactoryBot.create(:feature_page, exhibit: exhibit) }
7
+ let(:exhibit) { FactoryBot.create(:exhibit) }
7
8
  let(:block_data) { {} }
8
9
 
9
10
  describe '#items' do
@@ -21,6 +22,23 @@ describe SirTrevorRails::Blocks::FeaturedPagesBlock do
21
22
  end
22
23
  end
23
24
 
25
+ describe '#pages' do
26
+ let!(:page_a) { FactoryBot.create(:feature_page, slug: 'a', exhibit: exhibit) }
27
+ let!(:translated_page_a) { page_a.clone_for_locale('a').tap { |x| x.update(published: true) && x.save } }
28
+ let!(:page_b) { FactoryBot.create(:feature_page, slug: 'b', exhibit: exhibit) }
29
+
30
+ before do
31
+ block_data[:item] = {
32
+ '0': { id: 'a', display: 'true' },
33
+ '1': { id: 'b', display: 'true' }
34
+ }
35
+ end
36
+
37
+ it 'retrieves the pages from the default locale' do
38
+ expect(subject.pages.length).to eq 2
39
+ end
40
+ end
41
+
24
42
  describe '#as_json' do
25
43
  context 'when no items are present' do
26
44
  it 'returns an empty items value' do
@@ -74,7 +74,7 @@ describe SolrDocument, type: :model do
74
74
  it 'stores sidecar data on the sidecar object' do
75
75
  mock_sidecar = double
76
76
  allow(subject).to receive_messages(sidecar: mock_sidecar)
77
- expect(mock_sidecar).to receive(:update).with(data: { 'a' => 1 })
77
+ expect(mock_sidecar).to receive(:update).with({ data: { 'a' => 1 } })
78
78
  subject.update exhibit, sidecar: { data: { 'a' => 1 } }
79
79
  end
80
80
 
@@ -86,14 +86,14 @@ describe SolrDocument, type: :model do
86
86
  it 'converts empty strings to nil' do
87
87
  mock_sidecar = double
88
88
  allow(subject).to receive_messages(sidecar: mock_sidecar)
89
- expect(mock_sidecar).to receive(:update).with(data: { 'a' => nil })
89
+ expect(mock_sidecar).to receive(:update).with({ data: { 'a' => nil } })
90
90
  subject.update exhibit, sidecar: { data: { 'a' => '' } }
91
91
  end
92
92
 
93
93
  it 'compacts arrays of empty or nil values' do
94
94
  mock_sidecar = double
95
95
  allow(subject).to receive_messages(sidecar: mock_sidecar)
96
- expect(mock_sidecar).to receive(:update).with(data: { 'a' => ['a'] })
96
+ expect(mock_sidecar).to receive(:update).with({ data: { 'a' => ['a'] } })
97
97
  subject.update exhibit, sidecar: { data: { 'a' => ['', nil, 'a'] } }
98
98
  end
99
99
  end
@@ -28,9 +28,9 @@ describe Spotlight::PageConfigurations, type: :model do
28
28
 
29
29
  describe 'downstream configured_params' do
30
30
  it 'merges the supplied hash into the configs' do
31
- expect(page_config).to receive_messages(configured_params: { 'hello': 'goodbye' })
31
+ expect(page_config).to receive_messages(configured_params: { hello: 'goodbye' })
32
32
 
33
- expect(page_config.as_json).to include('hello': 'goodbye')
33
+ expect(page_config.as_json).to include(hello: 'goodbye')
34
34
  end
35
35
 
36
36
  it 'sends the #call method to the value if it can respond (e.g. a lamda)' do
@@ -130,7 +130,7 @@ describe Spotlight::Page, type: :model do
130
130
  expect(page.slug).to eq 'abc'
131
131
  end
132
132
 
133
- it 'blacklists contacts' do
133
+ it 'reserves the slug "contacts"' do
134
134
  page.update(title: 'contacts')
135
135
  expect(page.slug).not_to eq 'contacts'
136
136
  end
data/spec/spec_helper.rb CHANGED
@@ -29,7 +29,7 @@ Capybara.register_driver :headless_chrome do |app|
29
29
  opts.args << '--no-sandbox'
30
30
  opts.args << '--window-size=1280,1696'
31
31
  end
32
- Capybara::Selenium::Driver.new(app, browser: :chrome, options: browser_options)
32
+ Capybara::Selenium::Driver.new(app, browser: :chrome, capabilities: [browser_options])
33
33
  end
34
34
  require 'webmock/rspec'
35
35
  allowed_sites = ['chromedriver.storage.googleapis.com']
@@ -6,10 +6,10 @@ class CatalogController < ApplicationController
6
6
  before_action :set_paper_trail_whodunnit
7
7
 
8
8
  configure_blacklight do |config|
9
- config.view.gallery.document_component = Blacklight::Gallery::DocumentComponent
9
+ config.view.gallery(document_component: Blacklight::Gallery::DocumentComponent)
10
10
  # config.view.gallery.classes = 'row-cols-2 row-cols-md-3'
11
- config.view.masonry.document_component = Blacklight::Gallery::DocumentComponent
12
- config.view.slideshow.document_component = Blacklight::Gallery::SlideshowComponent
11
+ config.view.masonry(document_component: Blacklight::Gallery::DocumentComponent)
12
+ config.view.slideshow(document_component: Blacklight::Gallery::SlideshowComponent)
13
13
  config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
14
14
  config.show.partials.insert(1, :openseadragon)
15
15
  ## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
@@ -36,7 +36,6 @@ class CatalogController < ApplicationController
36
36
  config.index.thumbnail_field = Spotlight::Engine.config.thumbnail_field
37
37
 
38
38
  config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
39
- config.show.partials.insert(1, :openseadragon)
40
39
 
41
40
  config.add_results_collection_tool(:sort_widget)
42
41
  config.add_results_collection_tool(:per_page_widget)
@@ -33,12 +33,23 @@ describe 'spotlight/pages/show', type: :view do
33
33
  render
34
34
  end
35
35
 
36
- it 'does not double-escape HTML entities in the HTML title' do
37
- allow(page).to receive_messages(title: 'Abbott & Costello')
38
- stub_template 'shared/_user_util_links.html.erb' => ''
39
- stub_template 'shared/_masthead.html.erb' => ''
40
- render template: 'spotlight/pages/show', layout: 'layouts/spotlight/spotlight'
41
- expect(rendered).to have_content('Abbott & Costello | Blacklight')
36
+ context 'when rendering with layout' do
37
+ before do
38
+ allow(page).to receive_messages(title: 'Abbott & Costello')
39
+ allow_any_instance_of(Spotlight::Exhibit).to receive(:searchable?).and_return(true)
40
+ stub_template 'shared/_analytics.html.erb' => 'analytics'
41
+ stub_template 'shared/_user_util_links.html.erb' => ''
42
+ stub_template 'shared/_masthead.html.erb' => ''
43
+ render template: 'spotlight/pages/show', layout: 'layouts/spotlight/spotlight'
44
+ end
45
+
46
+ it 'does not double-escape HTML entities in the HTML title' do
47
+ expect(rendered).to have_content('Abbott & Costello | Blacklight')
48
+ end
49
+
50
+ it 'includes analytics reporting' do
51
+ expect(rendered).to have_content 'analytics'
52
+ end
42
53
  end
43
54
 
44
55
  it 'does not include the page title' do
@@ -1,8 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  describe 'spotlight/search_configurations/_facet_metadata', type: :view do
4
+ let(:field_config) { nil }
5
+ let(:blacklight_config) { nil }
6
+
4
7
  before do
5
- render partial: 'spotlight/search_configurations/facet_metadata', locals: { metadata: metadata }
8
+ render partial: 'spotlight/search_configurations/facet_metadata', locals: {
9
+ blacklight_config: blacklight_config,
10
+ field_config: field_config,
11
+ metadata: metadata
12
+ }
6
13
  end
7
14
 
8
15
  context 'with a facet without any documents' do
@@ -29,4 +36,23 @@ describe 'spotlight/search_configurations/_facet_metadata', type: :view do
29
36
  expect(rendered).to have_content '20+ unique values'
30
37
  end
31
38
  end
39
+
40
+ context 'with a facet with a configured limit' do
41
+ let(:metadata) { { document_count: 1, value_count: 10, terms: %w[] } }
42
+ let(:field_config) { Blacklight::Configuration::FacetField.new(limit: 10) }
43
+
44
+ it 'shows there are many unique values' do
45
+ expect(rendered).to have_content '10+ unique values'
46
+ end
47
+ end
48
+
49
+ context 'with a facet with an implicit limit' do
50
+ let(:blacklight_config) { CatalogController.blacklight_config }
51
+ let(:metadata) { { document_count: 1, value_count: 13, terms: %w[] } }
52
+ let(:field_config) { Blacklight::Configuration::FacetField.new(limit: true) }
53
+
54
+ it 'shows there are many unique values' do
55
+ expect(rendered).to have_content '10+ unique values'
56
+ end
57
+ end
32
58
  end
@@ -18,7 +18,6 @@ describe 'spotlight/tags/index.html.erb', type: :view do
18
18
  describe 'Tags' do
19
19
  it 'is displayed' do
20
20
  render
21
- puts rendered
22
21
  [tag1.tag.name, tag2.tag.name].each do |name|
23
22
  expect(rendered).to have_css('h4', text: name)
24
23
  expect(rendered).to have_link(name, href: '#edit-in-place')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blacklight-spotlight
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Beer
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2021-05-27 00:00:00.000000000 Z
14
+ date: 2022-03-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activejob-status
@@ -36,7 +36,7 @@ dependencies:
36
36
  version: '5.0'
37
37
  - - "<"
38
38
  - !ruby/object:Gem::Version
39
- version: '8'
39
+ version: '10'
40
40
  type: :runtime
41
41
  prerelease: false
42
42
  version_requirements: !ruby/object:Gem::Requirement
@@ -46,7 +46,7 @@ dependencies:
46
46
  version: '5.0'
47
47
  - - "<"
48
48
  - !ruby/object:Gem::Version
49
- version: '8'
49
+ version: '10'
50
50
  - !ruby/object:Gem::Dependency
51
51
  name: autoprefixer-rails
52
52
  requirement: !ruby/object:Gem::Requirement
@@ -431,16 +431,22 @@ dependencies:
431
431
  name: paper_trail
432
432
  requirement: !ruby/object:Gem::Requirement
433
433
  requirements:
434
- - - "~>"
434
+ - - ">="
435
435
  - !ruby/object:Gem::Version
436
436
  version: '11.0'
437
+ - - "<"
438
+ - !ruby/object:Gem::Version
439
+ version: '13'
437
440
  type: :runtime
438
441
  prerelease: false
439
442
  version_requirements: !ruby/object:Gem::Requirement
440
443
  requirements:
441
- - - "~>"
444
+ - - ">="
442
445
  - !ruby/object:Gem::Version
443
446
  version: '11.0'
447
+ - - "<"
448
+ - !ruby/object:Gem::Version
449
+ version: '13'
444
450
  - !ruby/object:Gem::Dependency
445
451
  name: rails
446
452
  requirement: !ruby/object:Gem::Requirement
@@ -1191,6 +1197,7 @@ files:
1191
1197
  - app/views/layouts/spotlight/spotlight.html.erb
1192
1198
  - app/views/shared/_about_navbar.html.erb
1193
1199
  - app/views/shared/_analytics.html.erb
1200
+ - app/views/shared/_body_preamble.html.erb
1194
1201
  - app/views/shared/_breadcrumbs.html.erb
1195
1202
  - app/views/shared/_browse_navbar.html.erb
1196
1203
  - app/views/shared/_curated_features_navbar.html.erb
@@ -1725,7 +1732,6 @@ files:
1725
1732
  - spec/uploaders/spotlight/featured_image_uploader_spec.rb
1726
1733
  - spec/views/shared/_analytics.html.erb_spec.rb
1727
1734
  - spec/views/shared/_exhibit_navbar.html.erb_spec.rb
1728
- - spec/views/shared/_footer.html.erb_spec.rb
1729
1735
  - spec/views/shared/_header_navbar.html.erb_spec.rb
1730
1736
  - spec/views/shared/_masthead.html.erb_spec.rb
1731
1737
  - spec/views/shared/_user_util_links.html.erb_spec.rb
@@ -1835,7 +1841,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
1835
1841
  - !ruby/object:Gem::Version
1836
1842
  version: '0'
1837
1843
  requirements: []
1838
- rubygems_version: 3.2.3
1844
+ rubygems_version: 3.2.32
1839
1845
  signing_key:
1840
1846
  specification_version: 4
1841
1847
  summary: Enable librarians, curators, and others who are responsible for digital collections
@@ -2085,7 +2091,6 @@ test_files:
2085
2091
  - spec/uploaders/spotlight/featured_image_uploader_spec.rb
2086
2092
  - spec/views/shared/_analytics.html.erb_spec.rb
2087
2093
  - spec/views/shared/_exhibit_navbar.html.erb_spec.rb
2088
- - spec/views/shared/_footer.html.erb_spec.rb
2089
2094
  - spec/views/shared/_header_navbar.html.erb_spec.rb
2090
2095
  - spec/views/shared/_masthead.html.erb_spec.rb
2091
2096
  - spec/views/shared/_user_util_links.html.erb_spec.rb
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- describe 'shared/_footer', type: :view do
4
- let(:current_exhibit) { double(title: 'Some title', subtitle: 'Subtitle') }
5
-
6
- before do
7
- allow(view).to receive_messages(current_exhibit: current_exhibit)
8
- end
9
-
10
- it 'includes analytics reporting' do
11
- stub_template 'shared/_analytics.html.erb' => 'analytics'
12
- render
13
- expect(rendered).to have_content 'analytics'
14
- end
15
- end