blacklight-spotlight 3.1.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/README.md +2 -2
- data/app/assets/stylesheets/spotlight/_breadcrumbs.scss +2 -4
- data/app/builders/spotlight/bootstrap_breadcrumbs_builder.rb +2 -2
- data/app/controllers/concerns/spotlight/controller.rb +13 -12
- data/app/controllers/spotlight/attachments_controller.rb +1 -1
- data/app/controllers/spotlight/custom_search_fields_controller.rb +1 -1
- data/app/controllers/spotlight/pages_controller.rb +3 -7
- data/app/controllers/spotlight/searches_controller.rb +6 -1
- data/app/helpers/spotlight/application_helper.rb +1 -1
- data/app/helpers/spotlight/job_trackers_helper.rb +1 -1
- data/app/helpers/spotlight/main_app_helpers.rb +1 -1
- data/app/helpers/spotlight/pages_helper.rb +12 -0
- data/app/helpers/spotlight/title_helper.rb +0 -2
- data/app/mailers/spotlight/confirmation_mailer.rb +2 -1
- data/app/models/sir_trevor_rails/block.rb +85 -0
- data/app/models/sir_trevor_rails/blocks/displayable.rb +1 -1
- data/app/models/sir_trevor_rails/blocks/featured_pages_block.rb +2 -2
- data/app/models/spotlight/contact_email.rb +1 -1
- data/app/models/spotlight/page.rb +8 -0
- data/app/models/spotlight/page_configurations.rb +1 -1
- data/app/models/spotlight/page_content/sir_trevor.rb +13 -4
- data/app/models/translation.rb +18 -0
- data/app/services/spotlight/exhibit_import_export_service.rb +1 -1
- data/app/views/layouts/spotlight/base.html.erb +3 -1
- data/app/views/shared/_site_sidebar.html.erb +1 -1
- data/app/views/spotlight/catalog/admin.html.erb +1 -1
- data/app/views/spotlight/confirmation_mailer/confirmation_instructions.html.erb +3 -3
- data/app/views/spotlight/exhibits/_import.html.erb +1 -1
- data/app/views/spotlight/exhibits/_languages.html.erb +2 -2
- data/app/views/spotlight/filters/_form.html.erb +1 -1
- data/app/views/spotlight/resources/upload/_form.html.erb +1 -1
- data/app/views/spotlight/search_configurations/_document_index_view_types.html.erb +1 -1
- data/app/views/spotlight/search_configurations/_facet_metadata.html.erb +4 -2
- data/app/views/spotlight/search_configurations/_facets.html.erb +1 -1
- data/app/views/spotlight/searches/_form.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_iframe_block.html.erb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_video_block.html.erb +5 -0
- data/app/views/spotlight/translations/_browse_categories.html.erb +1 -1
- data/app/views/spotlight/translations/_groups.html.erb +1 -1
- data/app/views/spotlight/translations/_import.html.erb +1 -1
- data/app/views/spotlight/translations/_metadata.html.erb +1 -1
- data/app/views/spotlight/translations/_search_fields.html.erb +1 -1
- data/config/i18n-tasks.yml +2 -1
- data/config/locales/spotlight.de.yml +40 -0
- data/config/locales/spotlight.en.yml +13 -4
- data/lib/generators/spotlight/install_generator.rb +40 -2
- data/lib/generators/spotlight/templates/config/initializers/translation.rb +15 -13
- 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 +4 -2
- data/lib/spotlight/version.rb +1 -1
- data/lib/tasks/spotlight_tasks.rake +41 -3
- 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 +1512 -1501
- data/spec/features/autocomplete_typeahead_spec.rb +3 -2
- data/spec/features/edit_search_fields_spec.rb +1 -1
- data/spec/features/exhibit_themes_spec.rb +3 -1
- data/spec/features/javascript/blocks/solr_documents_block_spec.rb +2 -0
- data/spec/helpers/spotlight/pages_helper_spec.rb +1 -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/sir_trevor_rails/blocks/featured_pages_block_spec.rb +19 -1
- data/spec/models/solr_document_spec.rb +4 -4
- data/spec/models/spotlight/browse_category_search_builder_spec.rb +3 -1
- data/spec/models/spotlight/page_spec.rb +1 -11
- data/spec/models/translation_spec.rb +12 -0
- data/spec/services/spotlight/etl/pipeline_spec.rb +1 -1
- data/spec/spec_helper.rb +2 -3
- data/spec/support/views/test_view_helpers.rb +1 -0
- data/spec/test_app_templates/catalog_controller.rb +3 -3
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +3 -1
- data/spec/views/spotlight/pages/show.html.erb_spec.rb +1 -0
- data/spec/views/spotlight/search_configurations/_facet_metadata.html.erb_spec.rb +27 -1
- data/spec/views/spotlight/tags/index.html.erb_spec.rb +0 -1
- metadata +113 -20
- data/lib/generators/spotlight/templates/config/initializers/sir_trevor_rails.rb +0 -10
@@ -16,12 +16,24 @@ 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
|
-
|
22
|
-
|
33
|
+
title = prompt_for_title
|
34
|
+
slug = prompt_for_slug
|
23
35
|
|
24
|
-
exhibit = Spotlight::Exhibit.create!(title: title)
|
36
|
+
exhibit = Spotlight::Exhibit.create!({ title: title, slug: slug })
|
25
37
|
|
26
38
|
puts 'Who can admin this exhibit?'
|
27
39
|
|
@@ -88,11 +100,15 @@ namespace :spotlight do
|
|
88
100
|
end
|
89
101
|
|
90
102
|
def prompt_for_email
|
103
|
+
return ENV['SPOTLIGHT_USER_EMAIL'] if ENV['SPOTLIGHT_USER_EMAIL']
|
104
|
+
|
91
105
|
print 'Email: '
|
92
106
|
$stdin.gets.chomp
|
93
107
|
end
|
94
108
|
|
95
109
|
def prompt_for_password
|
110
|
+
return ENV['SPOTLIGHT_USER_PASSWORD'] if ENV['SPOTLIGHT_USER_PASSWORD']
|
111
|
+
|
96
112
|
begin
|
97
113
|
system 'stty -echo'
|
98
114
|
print 'Password (must be 8+ characters): '
|
@@ -104,6 +120,20 @@ namespace :spotlight do
|
|
104
120
|
password
|
105
121
|
end
|
106
122
|
|
123
|
+
def prompt_for_title
|
124
|
+
return ENV['SPOTLIGHT_EXHIBIT_TITLE'] if ENV['SPOTLIGHT_EXHIBIT_TITLE']
|
125
|
+
|
126
|
+
print 'Exhibit title: '
|
127
|
+
$stdin.gets.chomp
|
128
|
+
end
|
129
|
+
|
130
|
+
def prompt_for_slug
|
131
|
+
return ENV['SPOTLIGHT_EXHIBIT_SLUG'] if ENV['SPOTLIGHT_EXHIBIT_SLUG']
|
132
|
+
|
133
|
+
print 'Exhibit URL slug: '
|
134
|
+
$stdin.gets.chomp
|
135
|
+
end
|
136
|
+
|
107
137
|
namespace :check do
|
108
138
|
desc 'Check the Solr connection and controller configuration'
|
109
139
|
task :solr, [:model_name] => ['blacklight:check:solr', :environment] do |_, _args|
|
@@ -141,4 +171,12 @@ namespace :spotlight do
|
|
141
171
|
e.reindex_later
|
142
172
|
end
|
143
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
|
144
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
|