blacklight-spotlight 3.3.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/spotlight/pages_controller.rb +1 -1
- data/app/helpers/spotlight/pages_helper.rb +12 -0
- data/app/helpers/spotlight/title_helper.rb +0 -2
- data/app/models/sir_trevor_rails/block.rb +85 -0
- data/app/models/sir_trevor_rails/blocks/displayable.rb +1 -1
- data/app/models/spotlight/page_content/sir_trevor.rb +13 -4
- data/app/models/translation.rb +18 -0
- data/app/views/shared/_site_sidebar.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_video_block.html.erb +5 -0
- data/config/i18n-tasks.yml +1 -0
- data/config/locales/spotlight.de.yml +40 -0
- data/lib/generators/spotlight/install_generator.rb +40 -2
- data/lib/generators/spotlight/templates/config/initializers/translation.rb +5 -5
- data/lib/generators/spotlight/templates/solr/config/schema.xml +32 -50
- data/lib/generators/spotlight/templates/solr/config/solrconfig.xml +14 -12
- data/lib/spotlight/engine.rb +1 -1
- data/lib/spotlight/version.rb +1 -1
- data/lib/tasks/spotlight_tasks.rake +20 -0
- data/spec/controllers/spotlight/about_pages_controller_spec.rb +1 -3
- data/spec/controllers/spotlight/catalog_controller_spec.rb +4 -4
- data/spec/controllers/spotlight/contact_forms_controller_spec.rb +2 -2
- data/spec/controllers/spotlight/contacts_controller_spec.rb +2 -2
- data/spec/controllers/spotlight/exhibits_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/feature_pages_controller_spec.rb +2 -2
- data/spec/controllers/spotlight/featured_images_controller_spec.rb +4 -4
- data/spec/controllers/spotlight/groups_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/searches_controller_spec.rb +3 -3
- data/spec/controllers/spotlight/solr_controller_spec.rb +1 -1
- data/spec/controllers/spotlight/tags_controller_spec.rb +1 -1
- data/spec/examples.txt +1506 -1506
- data/spec/features/autocomplete_typeahead_spec.rb +3 -2
- data/spec/features/exhibit_themes_spec.rb +3 -1
- data/spec/i18n_spec.rb +2 -3
- data/spec/lib/migration/iiif_spec.rb +2 -2
- data/spec/models/sir_trevor_rails/block_spec.rb +72 -0
- data/spec/models/solr_document_spec.rb +1 -1
- data/spec/models/spotlight/browse_category_search_builder_spec.rb +3 -1
- data/spec/models/spotlight/page_spec.rb +0 -10
- data/spec/models/translation_spec.rb +12 -0
- data/spec/services/spotlight/etl/pipeline_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -2
- data/spec/support/views/test_view_helpers.rb +1 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +3 -1
- metadata +98 -11
- data/lib/generators/spotlight/templates/config/initializers/sir_trevor_rails.rb +0 -10
@@ -3,9 +3,9 @@
|
|
3
3
|
<!-- NOTE: various comments and unused configuration possibilities have been purged
|
4
4
|
from this file. Please refer to http://wiki.apache.org/solr/SolrConfigXml,
|
5
5
|
as well as the default solrconfig file included with Solr -->
|
6
|
-
|
6
|
+
|
7
7
|
<abortOnConfigurationError>${solr.abortOnConfigurationError:true}</abortOnConfigurationError>
|
8
|
-
|
8
|
+
|
9
9
|
<luceneMatchVersion>6.1.0</luceneMatchVersion>
|
10
10
|
|
11
11
|
<directoryFactory name="DirectoryFactory" class="${solr.directoryFactory:solr.StandardDirectoryFactory}"/>
|
@@ -16,9 +16,11 @@
|
|
16
16
|
</updateLog>
|
17
17
|
</updateHandler>
|
18
18
|
|
19
|
-
<!-- solr lib dirs -->
|
19
|
+
<!-- solr lib dirs -->
|
20
20
|
<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" />
|
21
21
|
<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" />
|
22
|
+
<lib dir="${solr.install.dir:../../../..}/modules/analysis-extras/lib" />
|
23
|
+
<lib dir="${solr.install.dir:../../../..}/modules/analysis-extras/lucene-libs" />
|
22
24
|
|
23
25
|
<dataDir>${solr.data.dir:}</dataDir>
|
24
26
|
|
@@ -36,7 +38,7 @@
|
|
36
38
|
<float name="tie">0.01</float>
|
37
39
|
<!-- this qf and pf are used by default, if not otherwise specified by
|
38
40
|
client. The default blacklight_config will use these for the
|
39
|
-
"keywords" search. See the author_qf/author_pf, title_qf, etc
|
41
|
+
"keywords" search. See the author_qf/author_pf, title_qf, etc
|
40
42
|
below, which the default blacklight_config will specify for
|
41
43
|
those searches. You may also be interested in:
|
42
44
|
http://wiki.apache.org/solr/LocalParams
|
@@ -74,9 +76,9 @@
|
|
74
76
|
</str>
|
75
77
|
<str name="subject_pf">
|
76
78
|
</str>
|
77
|
-
|
79
|
+
|
78
80
|
<str name="fl">
|
79
|
-
*,
|
81
|
+
*,
|
80
82
|
score
|
81
83
|
</str>
|
82
84
|
|
@@ -85,7 +87,7 @@
|
|
85
87
|
<str name="facet.limit">10</str>
|
86
88
|
<str name="facet.field">active_fedora_model_ssi</str>
|
87
89
|
<str name="facet.field">subject_ssim</str>
|
88
|
-
|
90
|
+
|
89
91
|
<str name="spellcheck">true</str>
|
90
92
|
<str name="spellcheck.dictionary">default</str>
|
91
93
|
<str name="spellcheck.onlyMorePopular">true</str>
|
@@ -121,7 +123,7 @@
|
|
121
123
|
</str>
|
122
124
|
</lst>
|
123
125
|
</requestHandler>
|
124
|
-
|
126
|
+
|
125
127
|
<requestHandler name="standard" class="solr.SearchHandler">
|
126
128
|
<lst name="defaults">
|
127
129
|
<str name="echoParams">explicit</str>
|
@@ -152,12 +154,12 @@
|
|
152
154
|
<str name="buildOnOptimize">true</str>
|
153
155
|
</lst>
|
154
156
|
</searchComponent>
|
155
|
-
|
156
|
-
<requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />
|
157
|
-
|
157
|
+
|
158
|
+
<requestHandler name="/replication" class="solr.ReplicationHandler" startup="lazy" />
|
159
|
+
|
158
160
|
<requestDispatcher handleSelect="true" >
|
159
161
|
<requestParsers enableRemoteStreaming="true" multipartUploadLimitInKB="2048" />
|
160
162
|
</requestDispatcher>
|
161
|
-
|
163
|
+
|
162
164
|
<requestHandler name="/analysis/field" startup="lazy" class="solr.FieldAnalysisRequestHandler" />
|
163
165
|
</config>
|
data/lib/spotlight/engine.rb
CHANGED
data/lib/spotlight/version.rb
CHANGED
@@ -16,6 +16,18 @@ namespace :spotlight do
|
|
16
16
|
Spotlight::Role.create(user: u, resource: Spotlight::Site.instance, role: 'admin')
|
17
17
|
end
|
18
18
|
|
19
|
+
task seed_admin_user: [:environment] do
|
20
|
+
email = 'admin@localhost'
|
21
|
+
password = 'testing'
|
22
|
+
|
23
|
+
u = Spotlight::Engine.user_class.find_or_create_by!(email: email) do |user|
|
24
|
+
user.password = password
|
25
|
+
end
|
26
|
+
Spotlight::Role.create(user: u, resource: Spotlight::Site.instance, role: 'admin')
|
27
|
+
|
28
|
+
puts "Admin user created with email: #{email} (password: '#{password}')"
|
29
|
+
end
|
30
|
+
|
19
31
|
desc 'Create a new exhibit'
|
20
32
|
task exhibit: :environment do
|
21
33
|
title = prompt_for_title
|
@@ -159,4 +171,12 @@ namespace :spotlight do
|
|
159
171
|
e.reindex_later
|
160
172
|
end
|
161
173
|
end
|
174
|
+
|
175
|
+
task db_ready: :environment do
|
176
|
+
if I18n::Backend::ActiveRecord::Translation.table_exists?
|
177
|
+
exit 0
|
178
|
+
else
|
179
|
+
exit 1
|
180
|
+
end
|
181
|
+
end
|
162
182
|
end
|
@@ -169,8 +169,6 @@ describe Spotlight::AboutPagesController, type: :controller, versioning: true do
|
|
169
169
|
let!(:page2) { FactoryBot.create(:about_page, exhibit: exhibit, published: true) }
|
170
170
|
let!(:page3) { FactoryBot.create(:about_page, exhibit: exhibit, published: true) }
|
171
171
|
|
172
|
-
before { request.env['HTTP_REFERER'] = 'http://example.com' }
|
173
|
-
|
174
172
|
it 'updates whether they are on the landing page' do
|
175
173
|
post :update_all, params: {
|
176
174
|
exhibit_id: page1.exhibit,
|
@@ -181,7 +179,7 @@ describe Spotlight::AboutPagesController, type: :controller, versioning: true do
|
|
181
179
|
]
|
182
180
|
}
|
183
181
|
}
|
184
|
-
expect(response).to redirect_to '
|
182
|
+
expect(response).to redirect_to end_with('/dashboard')
|
185
183
|
expect(flash[:notice]).to eq 'About pages were successfully updated.'
|
186
184
|
expect(page1.reload.published).to be_truthy
|
187
185
|
expect(page1.title).to eq 'This is a new title!'
|
@@ -271,7 +271,7 @@ describe Spotlight::CatalogController, type: :controller do
|
|
271
271
|
|
272
272
|
describe 'PUT make_public' do
|
273
273
|
before do
|
274
|
-
request.env['HTTP_REFERER'] = 'where_i_came_from'
|
274
|
+
request.env['HTTP_REFERER'] = '/where_i_came_from'
|
275
275
|
allow_any_instance_of(::SolrDocument).to receive(:reindex)
|
276
276
|
end
|
277
277
|
|
@@ -279,13 +279,13 @@ describe Spotlight::CatalogController, type: :controller do
|
|
279
279
|
expect_any_instance_of(::SolrDocument).to receive(:reindex)
|
280
280
|
expect_any_instance_of(::SolrDocument).to receive(:make_public!).with(exhibit)
|
281
281
|
put :make_public, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
282
|
-
expect(response).to redirect_to 'where_i_came_from'
|
282
|
+
expect(response).to redirect_to end_with('/where_i_came_from')
|
283
283
|
end
|
284
284
|
end
|
285
285
|
|
286
286
|
describe 'DELETE make_private' do
|
287
287
|
before do
|
288
|
-
request.env['HTTP_REFERER'] = 'where_i_came_from'
|
288
|
+
request.env['HTTP_REFERER'] = '/where_i_came_from'
|
289
289
|
allow_any_instance_of(::SolrDocument).to receive(:reindex)
|
290
290
|
end
|
291
291
|
|
@@ -293,7 +293,7 @@ describe Spotlight::CatalogController, type: :controller do
|
|
293
293
|
expect_any_instance_of(::SolrDocument).to receive(:reindex)
|
294
294
|
expect_any_instance_of(::SolrDocument).to receive(:make_private!).with(exhibit)
|
295
295
|
delete :make_private, params: { exhibit_id: exhibit, id: 'dq287tq6352' }
|
296
|
-
expect(response).to redirect_to 'where_i_came_from'
|
296
|
+
expect(response).to redirect_to end_with('/where_i_came_from')
|
297
297
|
end
|
298
298
|
end
|
299
299
|
end
|
@@ -6,7 +6,7 @@ describe Spotlight::ContactFormsController, type: :controller do
|
|
6
6
|
let(:honeypot_field_name) { Spotlight::Engine.config.spambot_honeypot_email_field }
|
7
7
|
|
8
8
|
before do
|
9
|
-
request.env['HTTP_REFERER'] = '
|
9
|
+
request.env['HTTP_REFERER'] = '/whatever'
|
10
10
|
exhibit.contact_emails_attributes = [{ 'email' => 'test@example.com' }, { 'email' => 'test2@example.com' }]
|
11
11
|
exhibit.save!
|
12
12
|
exhibit.contact_emails.first.tap do |e|
|
@@ -27,7 +27,7 @@ describe Spotlight::ContactFormsController, type: :controller do
|
|
27
27
|
|
28
28
|
it 'redirects back' do
|
29
29
|
post :create, params: { exhibit_id: exhibit.id, contact_form: { name: 'Joe Doe', email: 'jdoe@example.com', honeypot_field_name => '' } }
|
30
|
-
expect(response).to redirect_to '
|
30
|
+
expect(response).to redirect_to end_with('/whatever')
|
31
31
|
end
|
32
32
|
|
33
33
|
it 'sets a flash message' do
|
@@ -67,7 +67,7 @@ describe Spotlight::ContactsController, type: :controller do
|
|
67
67
|
contact # force contact to be created
|
68
68
|
expect do
|
69
69
|
delete :destroy, params: { id: contact, exhibit_id: contact.exhibit }
|
70
|
-
end.to change
|
70
|
+
end.to change(Spotlight::Contact, :count).by(-1)
|
71
71
|
expect(response).to redirect_to exhibit_about_pages_path(exhibit)
|
72
72
|
end
|
73
73
|
end
|
@@ -93,7 +93,7 @@ describe Spotlight::ContactsController, type: :controller do
|
|
93
93
|
it 'is successful' do
|
94
94
|
expect do
|
95
95
|
post :create, params: { exhibit_id: exhibit, contact: { name: 'Chester', avatar_attributes: { iiif_tilesource: 'someurl' } } }
|
96
|
-
end.to change
|
96
|
+
end.to change(Spotlight::Contact, :count).by(1)
|
97
97
|
expect(response).to redirect_to exhibit_about_pages_path(exhibit)
|
98
98
|
expect(Spotlight::Contact.last.show_in_sidebar).to be_truthy
|
99
99
|
expect(Spotlight::Contact.last.avatar.iiif_url).to be_present
|
@@ -106,7 +106,7 @@ describe Spotlight::ExhibitsController, type: :controller do
|
|
106
106
|
it 'is successful' do
|
107
107
|
expect do
|
108
108
|
post :create, params: { exhibit: { title: 'Some Title', slug: 'custom-slug', tag_list: '2014, R. Buckminster Fuller' } }
|
109
|
-
end.to change
|
109
|
+
end.to change(Spotlight::Exhibit, :count).by(1)
|
110
110
|
|
111
111
|
exhibit = Spotlight::Exhibit.last
|
112
112
|
expect(response).to redirect_to(exhibit_dashboard_path(exhibit))
|
@@ -209,11 +209,11 @@ describe Spotlight::FeaturePagesController, type: :controller, versioning: true
|
|
209
209
|
let!(:page2) { FactoryBot.create(:feature_page, exhibit: page1.exhibit) }
|
210
210
|
let!(:page3) { FactoryBot.create(:feature_page, exhibit: page1.exhibit, parent_page_id: page1.id) }
|
211
211
|
|
212
|
-
before { request.env['HTTP_REFERER'] = '
|
212
|
+
before { request.env['HTTP_REFERER'] = '/whatever' }
|
213
213
|
|
214
214
|
it 'updates the parent/child relationship' do
|
215
215
|
post :update_all, params: { exhibit_id: page1.exhibit, exhibit: { feature_pages_attributes: [{ id: page2.id, parent_page_id: page1.id }] } }
|
216
|
-
expect(response).to redirect_to '
|
216
|
+
expect(response).to redirect_to end_with('/whatever')
|
217
217
|
expect(flash[:notice]).to eq 'Feature pages were successfully updated.'
|
218
218
|
expect(page1.parent_page).to be_nil
|
219
219
|
expect(page1.child_pages).to include page2
|
@@ -16,7 +16,7 @@ describe Spotlight::FeaturedImagesController, type: :controller do
|
|
16
16
|
image: fixture_file_upload('spec/fixtures/800x600.png', 'image/png')
|
17
17
|
}
|
18
18
|
}
|
19
|
-
end.not_to change
|
19
|
+
end.not_to change(Spotlight::FeaturedImage, :count)
|
20
20
|
|
21
21
|
expect(response).to redirect_to main_app.root_path
|
22
22
|
expect(flash[:alert]).to be_present
|
@@ -37,7 +37,7 @@ describe Spotlight::FeaturedImagesController, type: :controller do
|
|
37
37
|
image: fixture_file_upload('spec/fixtures/800x600.png', 'image/png')
|
38
38
|
}
|
39
39
|
}
|
40
|
-
end.to change
|
40
|
+
end.to change(Spotlight::FeaturedImage, :count).by(1)
|
41
41
|
|
42
42
|
expect(response).to be_successful
|
43
43
|
expect(response.body).to match %r{\{"tilesource":"http://test\.host/images/\d+-.+/info\.json","id":\d+\}}
|
@@ -52,7 +52,7 @@ describe Spotlight::FeaturedImagesController, type: :controller do
|
|
52
52
|
image: fixture_file_upload('spec/fixtures/800x600.png', 'image/png')
|
53
53
|
}
|
54
54
|
}
|
55
|
-
end.to change
|
55
|
+
end.to change(Spotlight::FeaturedImage, :count).by(1)
|
56
56
|
|
57
57
|
expect(response).to be_successful
|
58
58
|
expect(response.body).to match %r{\{"tilesource":"http://test\.host/images/\d+-.+/info\.json","id":\d+\}}
|
@@ -67,7 +67,7 @@ describe Spotlight::FeaturedImagesController, type: :controller do
|
|
67
67
|
image: fixture_file_upload('spec/fixtures/800x600.png', 'image/png')
|
68
68
|
}
|
69
69
|
}
|
70
|
-
end.to change
|
70
|
+
end.to change(Spotlight::FeaturedImage, :count).by(1)
|
71
71
|
|
72
72
|
expect(response).to be_successful
|
73
73
|
expect(response.body).to match %r{\{"tilesource":"http://test\.host/images/\d+-.+/info\.json","id":\d+\}}
|
@@ -96,7 +96,7 @@ describe Spotlight::GroupsController, type: :controller do
|
|
96
96
|
group
|
97
97
|
expect do
|
98
98
|
delete :destroy, params: { id: group.id, exhibit_id: group.exhibit }
|
99
|
-
end.to change
|
99
|
+
end.to change(Spotlight::Group, :count).by(-1)
|
100
100
|
end
|
101
101
|
end
|
102
102
|
end
|
@@ -160,7 +160,7 @@ describe Spotlight::SearchesController, type: :controller do
|
|
160
160
|
it 'removes it' do
|
161
161
|
expect do
|
162
162
|
delete :destroy, params: { id: search, exhibit_id: search.exhibit }
|
163
|
-
end.to change
|
163
|
+
end.to change(Spotlight::Search, :count).by(-1)
|
164
164
|
expect(response).to redirect_to exhibit_searches_path(search.exhibit)
|
165
165
|
expect(flash[:alert]).to eq 'The browse category was deleted.'
|
166
166
|
end
|
@@ -170,7 +170,7 @@ describe Spotlight::SearchesController, type: :controller do
|
|
170
170
|
let!(:search2) { FactoryBot.create(:search, exhibit: exhibit, published: true) }
|
171
171
|
let!(:search3) { FactoryBot.create(:search, exhibit: exhibit, published: true) }
|
172
172
|
|
173
|
-
before { request.env['HTTP_REFERER'] = '
|
173
|
+
before { request.env['HTTP_REFERER'] = '/whatever' }
|
174
174
|
|
175
175
|
it 'updates whether they are on the landing page' do
|
176
176
|
post :update_all, params: {
|
@@ -187,7 +187,7 @@ describe Spotlight::SearchesController, type: :controller do
|
|
187
187
|
expect(search.weight).to eq 1
|
188
188
|
expect(search2.reload.published).to be_falsey
|
189
189
|
expect(search3.reload.published).to be_truthy # should remain untouched since it wasn't present
|
190
|
-
expect(response).to redirect_to '
|
190
|
+
expect(response).to redirect_to end_with('/whatever')
|
191
191
|
expect(flash[:notice]).to eq 'Browse categories were successfully updated.'
|
192
192
|
end
|
193
193
|
end
|
@@ -87,7 +87,7 @@ describe Spotlight::SolrController, type: :controller do
|
|
87
87
|
|
88
88
|
expect do
|
89
89
|
post_update_with_json_body(exhibit, a: 1, custom_field: 'abc')
|
90
|
-
end.to change
|
90
|
+
end.to change(Spotlight::SolrDocumentSidecar, :count).by(1)
|
91
91
|
|
92
92
|
expect(response).to be_successful
|
93
93
|
expect(doc.first).to include a: 1
|
@@ -48,7 +48,7 @@ describe Spotlight::TagsController, type: :controller do
|
|
48
48
|
perform_enqueued_jobs do
|
49
49
|
delete :destroy, params: { exhibit_id: exhibit, id: tagging.tag }
|
50
50
|
end
|
51
|
-
end.to change
|
51
|
+
end.to change(ActsAsTaggableOn::Tagging, :count).by(-1)
|
52
52
|
expect(response).to redirect_to exhibit_tags_path(exhibit)
|
53
53
|
end
|
54
54
|
end
|