blacklight-spotlight 3.0.0.rc6 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/spotlight/admin/blocks/block.js +4 -0
  3. data/app/controllers/spotlight/pages_controller.rb +3 -2
  4. data/app/jobs/spotlight/process_bulk_updates_csv_job.rb +1 -1
  5. data/app/jobs/spotlight/reindex_exhibit_job.rb +9 -1
  6. data/app/models/sir_trevor_rails/blocks/browse_block.rb +1 -1
  7. data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +1 -1
  8. data/app/models/spotlight/featured_image.rb +33 -0
  9. data/app/models/spotlight/search.rb +3 -1
  10. data/app/views/layouts/spotlight/base.html.erb +2 -1
  11. data/app/views/shared/_body_preamble.html.erb +0 -0
  12. data/app/views/shared/_footer.html.erb +0 -1
  13. data/app/views/shared/_masthead.html.erb +1 -1
  14. data/app/views/shared/_user_util_links.html.erb +8 -2
  15. data/app/views/spotlight/about_pages/_sidebar.html.erb +2 -2
  16. data/app/views/spotlight/browse/_search.html.erb +3 -3
  17. data/app/views/spotlight/browse/_search_title.html.erb +1 -1
  18. data/app/views/spotlight/feature_pages/_sidebar.html.erb +1 -1
  19. data/app/views/spotlight/pages/_order_pages.html.erb +2 -2
  20. data/app/views/spotlight/pages/show.html.erb +1 -1
  21. data/app/views/spotlight/sir_trevor/blocks/_search_results_block.html.erb +2 -1
  22. data/db/migrate/20210506070809_add_indexes_for_featured_images.rb +9 -0
  23. data/lib/generators/spotlight/install_generator.rb +16 -7
  24. data/lib/spotlight/version.rb +1 -1
  25. data/spec/examples.txt +1499 -1496
  26. data/spec/factories/bulk_updates.rb +6 -0
  27. data/spec/features/javascript/blocks/search_result_block_spec.rb +1 -1
  28. data/spec/features/report_a_problem_spec.rb +1 -0
  29. data/spec/fixtures/iiif_responses.rb +81 -81
  30. data/spec/fixtures/updated-bulk-update-template-no-cols.csv +4 -0
  31. data/spec/jobs/spotlight/process_bulk_updates_csv_job_spec.rb +8 -0
  32. data/spec/models/spotlight/access_controls_enforcement_search_builder_spec.rb +1 -2
  33. data/spec/models/spotlight/featured_image_spec.rb +12 -0
  34. data/spec/models/spotlight/page_configurations_spec.rb +2 -2
  35. data/spec/test_app_templates/catalog_controller.rb +0 -1
  36. data/spec/views/spotlight/pages/show.html.erb_spec.rb +16 -6
  37. metadata +12 -10
  38. data/spec/views/shared/_footer.html.erb_spec.rb +0 -15
@@ -7,6 +7,12 @@ FactoryBot.define do
7
7
  exhibit
8
8
  end
9
9
 
10
+ factory :bulk_update_no_cols, class: 'Spotlight::BulkUpdate' do
11
+ file { Rack::Test::UploadedFile.new(File.expand_path(File.join('..', 'fixtures', 'updated-bulk-update-template-no-cols.csv'), __dir__)) }
12
+
13
+ exhibit
14
+ end
15
+
10
16
  factory :tagged_bulk_update, class: 'Spotlight::BulkUpdate' do
11
17
  file { Rack::Test::UploadedFile.new(File.expand_path(File.join('..', 'fixtures', 'updated-bulk-update-template-w-tags.csv'), __dir__)) }
12
18
 
@@ -42,6 +42,6 @@ describe 'Search Result Block', type: :feature, js: true do
42
42
  end
43
43
 
44
44
  # Documents should exist
45
- expect(page).to have_css('.documents .document')
45
+ expect(page).to have_css('.documents-gallery .document')
46
46
  end
47
47
  end
@@ -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
  }
@@ -0,0 +1,4 @@
1
+ Item ID,Item Title
2
+ bm387cy2596,L'AMERIQVE
3
+ cz507zk0531,NEW MEXICO
4
+ dq287tq6352,L'AMERIQUE
@@ -36,6 +36,14 @@ describe Spotlight::ProcessBulkUpdatesCsvJob do
36
36
  expect(SolrDocument.index.connection).not_to have_received(:update)
37
37
  end
38
38
  end
39
+
40
+ context 'without a visibility column' do
41
+ let(:bulk_update) { FactoryBot.create(:bulk_update_no_cols, exhibit: exhibit) }
42
+
43
+ it 'does nothing with the data' do
44
+ expect { subject.perform_now }.not_to(change { exhibit.reload.solr_document_sidecars.where(public: false).count })
45
+ end
46
+ end
39
47
  end
40
48
 
41
49
  describe 'tags' do
@@ -42,8 +42,7 @@ describe Spotlight::AccessControlsEnforcementSearchBuilder do
42
42
  it 'does not filter resources to just those created by the exhibit' do
43
43
  allow(current_ability).to receive(:can?).and_return(true)
44
44
  subject.apply_permissive_visibility_filter(solr_request)
45
- expect(solr_request).to include :fq
46
- expect(solr_request[:fq]).not_to include "{!term f=spotlight_exhibit_slug_#{exhibit.slug}_bsi}true"
45
+ expect(solr_request[:fq]).to be_blank
47
46
  end
48
47
  end
49
48
 
@@ -5,6 +5,18 @@ describe Spotlight::FeaturedImage do
5
5
 
6
6
  let(:temp_image) { FactoryBot.create(:temporary_image) }
7
7
 
8
+ describe '#bust_containing_resource_caches' do
9
+ let!(:feature_page) { FactoryBot.create(:feature_page, thumbnail: temp_image) }
10
+ let!(:feature_page2) { FactoryBot.create(:feature_page, thumbnail: temp_image) }
11
+
12
+ it 'changes the updated_at for all resources that might be using this image' do
13
+ temp_image.save
14
+
15
+ expect(feature_page.updated_at).to be < feature_page.reload.updated_at
16
+ expect(feature_page2.updated_at).to be < feature_page2.reload.updated_at
17
+ end
18
+ end
19
+
8
20
  context 'with an uploaded image' do
9
21
  it 'copies the temporary uploaded image to this model' do
10
22
  featured_image.source = 'remote'
@@ -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
@@ -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,22 @@ 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
+ stub_template 'shared/_analytics.html.erb' => 'analytics'
40
+ stub_template 'shared/_user_util_links.html.erb' => ''
41
+ stub_template 'shared/_masthead.html.erb' => ''
42
+ render template: 'spotlight/pages/show', layout: 'layouts/spotlight/spotlight'
43
+ end
44
+
45
+ it 'does not double-escape HTML entities in the HTML title' do
46
+ expect(rendered).to have_content('Abbott & Costello | Blacklight')
47
+ end
48
+
49
+ it 'includes analytics reporting' do
50
+ expect(rendered).to have_content 'analytics'
51
+ end
42
52
  end
43
53
 
44
54
  it 'does not include the page title' do