blacklight-spotlight 2.2.1 → 2.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/spotlight/catalog.rb +1 -0
  3. data/app/controllers/spotlight/browse_controller.rb +1 -0
  4. data/app/controllers/spotlight/contact_forms_controller.rb +1 -0
  5. data/app/controllers/spotlight/pages_controller.rb +1 -0
  6. data/app/helpers/spotlight/languages_helper.rb +1 -0
  7. data/app/models/concerns/spotlight/exhibit_analytics.rb +1 -0
  8. data/app/models/concerns/spotlight/solr_document.rb +1 -0
  9. data/app/models/concerns/spotlight/solr_document/atomic_updates.rb +1 -0
  10. data/app/models/sir_trevor_rails/blocks/textable.rb +1 -0
  11. data/app/models/spotlight/analytics/ga.rb +5 -5
  12. data/app/models/spotlight/blacklight_configuration.rb +2 -0
  13. data/app/models/spotlight/featured_image.rb +3 -0
  14. data/app/models/spotlight/page.rb +3 -0
  15. data/app/models/spotlight/page_configurations.rb +1 -0
  16. data/app/models/spotlight/reindex_progress.rb +3 -0
  17. data/app/models/spotlight/resource.rb +1 -0
  18. data/app/models/spotlight/resources/iiif_harvester.rb +1 -0
  19. data/app/models/spotlight/resources/iiif_manifest.rb +8 -0
  20. data/app/models/spotlight/search.rb +1 -0
  21. data/app/models/spotlight/solr_document_sidecar.rb +1 -1
  22. data/app/serializers/spotlight/exhibit_export_serializer.rb +1 -0
  23. data/app/services/spotlight/carrierwave_file_resolver.rb +1 -0
  24. data/app/services/spotlight/iiif_resource_resolver.rb +13 -10
  25. data/app/services/spotlight/solr_document_builder.rb +2 -0
  26. data/db/migrate/20180822233601_change_type_of_taggings_taggable.rb +8 -0
  27. data/lib/generators/spotlight/install_generator.rb +0 -4
  28. data/lib/migration/iiif.rb +6 -0
  29. data/lib/spotlight/upload_field_config.rb +4 -2
  30. data/lib/spotlight/version.rb +1 -1
  31. data/spec/examples.txt +1282 -1295
  32. data/spec/features/exhibits/translation_editing_spec.rb +9 -9
  33. data/spec/features/javascript/edit_in_place_spec.rb +1 -0
  34. data/spec/models/solr_document_spec.rb +3 -2
  35. data/spec/models/spotlight/blacklight_configuration_spec.rb +1 -1
  36. data/spec/models/spotlight/exhibit_spec.rb +1 -1
  37. data/spec/models/spotlight/page_spec.rb +1 -1
  38. data/spec/models/spotlight/resources/upload_spec.rb +4 -3
  39. data/spec/models/spotlight/solr_document_sidecar_spec.rb +13 -0
  40. data/spec/support/features/capybara_default_max_wait_metadata_helper.rb +2 -0
  41. data/spec/views/spotlight/exhibits/edit.html.erb_spec.rb +2 -2
  42. metadata +11 -12
  43. data/lib/generators/spotlight/increase_paper_trail_column_size_generator.rb +0 -17
  44. data/lib/generators/spotlight/templates/migrations/20180814221815_change_paper_trail_versions_object_column_to_medium_text.rb +0 -11
@@ -42,6 +42,15 @@ describe 'Translation editing', type: :feature do
42
42
  end
43
43
 
44
44
  describe 'main menu' do
45
+ before do
46
+ exhibit.searches.first.update(published: true)
47
+ within '.translation-edit-form #general' do
48
+ fill_in 'Home', with: 'Maison'
49
+ fill_in 'Browse', with: 'parcourir ceci!'
50
+ click_button 'Save changes'
51
+ end
52
+ end
53
+
45
54
  it 'adds translations to exhibit navbar' do
46
55
  within '.translation-edit-form #general' do
47
56
  expect(page).to have_css '.help-block', text: 'Home'
@@ -70,15 +79,6 @@ describe 'Translation editing', type: :feature do
70
79
  I18n.locale = I18n.default_locale
71
80
  end
72
81
 
73
- before do
74
- exhibit.searches.first.update(published: true)
75
- within '.translation-edit-form #general' do
76
- fill_in 'Home', with: 'Maison'
77
- fill_in 'Browse', with: 'parcourir ceci!'
78
- click_button 'Save changes'
79
- end
80
- end
81
-
82
82
  it 'adds translations to user-facing breadcrumbs' do
83
83
  expect(page).to have_css '.flash_messages', text: 'The exhibit was successfully updated.'
84
84
  visit spotlight.exhibit_browse_index_path(exhibit, locale: 'fr')
@@ -29,6 +29,7 @@ describe 'Edit in place', type: :feature, js: true do
29
29
  end
30
30
 
31
31
  it 'rejects blank values' do
32
+ skip('Passes locally, but soooo flakey on Travis.') if ENV['CI']
32
33
  visit spotlight.exhibit_dashboard_path(exhibit)
33
34
 
34
35
  click_link 'Feature pages'
@@ -1,12 +1,13 @@
1
1
  describe SolrDocument, type: :model do
2
2
  let(:document) { described_class.new(id: 'abcd123') }
3
3
  subject { document }
4
- its(:to_key) { should == ['abcd123'] }
5
- its(:persisted?) { should be_truthy }
6
4
  before do
7
5
  allow(subject).to receive_messages(reindex: nil)
8
6
  end
9
7
 
8
+ its(:to_key) { should == ['abcd123'] }
9
+ its(:persisted?) { should be_truthy }
10
+
10
11
  let(:exhibit) { FactoryBot.create(:exhibit) }
11
12
  let(:exhibit_alt) { FactoryBot.create(:exhibit) }
12
13
 
@@ -16,7 +16,7 @@ describe Spotlight::BlacklightConfiguration, type: :model do
16
16
  end
17
17
 
18
18
  it 'is expected to be versioned' do
19
- is_expected.to be_versioned
19
+ expect(subject).to be_versioned
20
20
  end
21
21
 
22
22
  it 'touches the exhibit' do
@@ -346,7 +346,7 @@ describe Spotlight::Exhibit, type: :model do
346
346
  end
347
347
 
348
348
  it 'is expected to be versioned' do
349
- is_expected.to be_versioned
349
+ expect(subject).to be_versioned
350
350
  end
351
351
  describe 'translatable fields' do
352
352
  let(:persisted_exhibit) { FactoryBot.create(:exhibit, title: 'Sample', subtitle: 'SubSample', description: 'Description') }
@@ -16,7 +16,7 @@ describe Spotlight::Page, type: :model do
16
16
  end
17
17
 
18
18
  it 'is expected to be versioned' do
19
- is_expected.to be_versioned
19
+ expect(subject).to be_versioned
20
20
  end
21
21
 
22
22
  describe '#top_level_page?' do
@@ -5,7 +5,7 @@ describe Spotlight::Resources::Upload, type: :model do
5
5
  let(:doc_builder) { resource.document_builder }
6
6
 
7
7
  let(:configured_fields) { [title_field] + described_class.fields(exhibit) }
8
- let(:title_field) { OpenStruct.new(field_name: 'configured_title_field') }
8
+ let(:title_field) { Spotlight::UploadFieldConfig.new(field_name: 'configured_title_field') }
9
9
  let(:upload_data) do
10
10
  {
11
11
  title_field.field_name => 'Title Data',
@@ -30,7 +30,7 @@ describe Spotlight::Resources::Upload, type: :model do
30
30
  end
31
31
 
32
32
  context 'with a custom upload title field' do
33
- let(:title_field) { OpenStruct.new(field_name: 'configured_title_field', solr_field: :some_other_field) }
33
+ let(:title_field) { Spotlight::UploadFieldConfig.new(field_name: 'configured_title_field', solr_fields: [:some_other_field]) }
34
34
  subject { doc_builder.to_solr }
35
35
 
36
36
  describe '#to_solr' do
@@ -43,7 +43,7 @@ describe Spotlight::Resources::Upload, type: :model do
43
43
  context 'multiple solr field mappings' do
44
44
  let :configured_fields do
45
45
  [
46
- OpenStruct.new(field_name: 'some_field', solr_field: %w(a b))
46
+ Spotlight::UploadFieldConfig.new(field_name: 'some_field', solr_fields: %w(a b))
47
47
  ]
48
48
  end
49
49
 
@@ -55,6 +55,7 @@ describe Spotlight::Resources::Upload, type: :model do
55
55
  subject { doc_builder.to_solr }
56
56
 
57
57
  it 'maps a single uploaded field to multiple solr fields' do
58
+ expect(subject).not_to include 'some_field'
58
59
  expect(subject['a']).to eq 'value'
59
60
  expect(subject['b']).to eq 'value'
60
61
  end
@@ -13,5 +13,18 @@ describe Spotlight::SolrDocumentSidecar, type: :model do
13
13
  its(:to_solr) { should include id: 'doc_id' }
14
14
  its(:to_solr) { should include "exhibit_#{exhibit.slug}_public_bsi".to_sym => true }
15
15
  its(:to_solr) { should include 'a_tesim', 'b_tesim', 'c_tesim' }
16
+
17
+ context 'with an uploaded item' do
18
+ before do
19
+ subject.data = { 'configured_fields' => { 'some_configured_field' => 'some value' } }
20
+ allow(Spotlight::Resources::Upload).to receive(:fields).with(exhibit).and_return([uploaded_field_config])
21
+ end
22
+
23
+ let(:uploaded_field_config) do
24
+ Spotlight::UploadFieldConfig.new(field_name: 'some_configured_field', solr_fields: ['the_solr_field'])
25
+ end
26
+
27
+ its(:to_solr) { should include 'the_solr_field' => 'some value' }
28
+ end
16
29
  end
17
30
  end
@@ -4,12 +4,14 @@ module CapybaraDefaultMaxWaitMetadataHelper
4
4
  included do
5
5
  before do |example|
6
6
  next unless example.metadata[:default_max_wait_time]
7
+
7
8
  @previous_wait_time = Capybara.default_max_wait_time
8
9
  Capybara.default_max_wait_time = example.metadata[:default_max_wait_time]
9
10
  end
10
11
 
11
12
  after do |example|
12
13
  next unless example.metadata[:default_max_wait_time]
14
+
13
15
  Capybara.default_max_wait_time = @previous_wait_time
14
16
  end
15
17
  end
@@ -5,8 +5,8 @@ describe 'spotlight/exhibits/edit', type: :view do
5
5
  allow(view).to receive_messages(
6
6
  current_exhibit: exhibit,
7
7
  can?: true,
8
- import_exhibit_path: '/',
9
- get_exhibit_path: '/',
8
+ import_exhibit_path: '/',
9
+ get_exhibit_path: '/',
10
10
  exhibit_filters_path: '/',
11
11
  exhibit_languages_path: '/',
12
12
  add_exhibit_language_dropdown_options: [],
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: 2.2.1
4
+ version: 2.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: 2018-08-20 00:00:00.000000000 Z
14
+ date: 2018-10-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -373,16 +373,16 @@ dependencies:
373
373
  name: paper_trail
374
374
  requirement: !ruby/object:Gem::Requirement
375
375
  requirements:
376
- - - ">="
376
+ - - "~>"
377
377
  - !ruby/object:Gem::Version
378
- version: '7.0'
378
+ version: '10.0'
379
379
  type: :runtime
380
380
  prerelease: false
381
381
  version_requirements: !ruby/object:Gem::Requirement
382
382
  requirements:
383
- - - ">="
383
+ - - "~>"
384
384
  - !ruby/object:Gem::Version
385
- version: '7.0'
385
+ version: '10.0'
386
386
  - !ruby/object:Gem::Dependency
387
387
  name: openseadragon
388
388
  requirement: !ruby/object:Gem::Requirement
@@ -653,16 +653,16 @@ dependencies:
653
653
  name: chromedriver-helper
654
654
  requirement: !ruby/object:Gem::Requirement
655
655
  requirements:
656
- - - ">="
656
+ - - "<"
657
657
  - !ruby/object:Gem::Version
658
- version: '0'
658
+ version: 2.0.0
659
659
  type: :development
660
660
  prerelease: false
661
661
  version_requirements: !ruby/object:Gem::Requirement
662
662
  requirements:
663
- - - ">="
663
+ - - "<"
664
664
  - !ruby/object:Gem::Version
665
- version: '0'
665
+ version: 2.0.0
666
666
  - !ruby/object:Gem::Dependency
667
667
  name: selenium-webdriver
668
668
  requirement: !ruby/object:Gem::Requirement
@@ -1263,8 +1263,8 @@ files:
1263
1263
  - db/migrate/20180405044000_add_locale_to_pages.rb
1264
1264
  - db/migrate/20180406212516_add_default_locale_reference_to_spotlight_pages.rb
1265
1265
  - db/migrate/20180529225807_change_spotlight_pages_content_column_to_medium_text.rb
1266
+ - db/migrate/20180822233601_change_type_of_taggings_taggable.rb
1266
1267
  - lib/blacklight/spotlight.rb
1267
- - lib/generators/spotlight/increase_paper_trail_column_size_generator.rb
1268
1268
  - lib/generators/spotlight/install_generator.rb
1269
1269
  - lib/generators/spotlight/scaffold_resource_generator.rb
1270
1270
  - lib/generators/spotlight/templates/catalog_controller.rb
@@ -1272,7 +1272,6 @@ files:
1272
1272
  - lib/generators/spotlight/templates/config/initializers/spotlight_initializer.rb
1273
1273
  - lib/generators/spotlight/templates/config/initializers/translation.rb
1274
1274
  - lib/generators/spotlight/templates/config/sitemap.rb
1275
- - lib/generators/spotlight/templates/migrations/20180814221815_change_paper_trail_versions_object_column_to_medium_text.rb
1276
1275
  - lib/generators/spotlight/templates/solr/config/schema.xml
1277
1276
  - lib/generators/spotlight/templates/solr/config/solrconfig.xml
1278
1277
  - lib/generators/spotlight/templates/spotlight.js
@@ -1,17 +0,0 @@
1
- require 'rails/generators'
2
-
3
- module Spotlight
4
- ##
5
- # spotlight:increase_paper_trail_column_size generator
6
- class IncreasePaperTrailColumnSize < Rails::Generators::Base
7
- source_root File.expand_path('templates', __dir__)
8
-
9
- def add_paper_trail_column_size_increase_migration
10
- rake 'db:migrate' # run migrations so that the versions table is created
11
- copy_file(
12
- 'migrations/20180814221815_change_paper_trail_versions_object_column_to_medium_text.rb',
13
- 'db/migrate/20180814221815_change_paper_trail_versions_object_column_to_medium_text.rb'
14
- )
15
- end
16
- end
17
- end
@@ -1,11 +0,0 @@
1
- ##
2
- # A migration that updates the object column size on PaperTrail's version table
3
- # This is in a generator template because our migrations run before PaperTrail is installed
4
- class ChangePaperTrailVersionsObjectColumnToMediumText < ActiveRecord::Migration[5.1]
5
- # See https://github.com/paper-trail-gem/paper_trail/blob/6c34a3dd5a5f8c1b042f458b7727c9d3bbf81a50/lib/generators/paper_trail/install/templates/create_versions.rb.erb#L5-L17
6
- # for rationale of the 1,073,741,823 byte limit
7
-
8
- def change
9
- change_column :versions, :object, :text, limit: 1_073_741_823
10
- end
11
- end