blacklight-spotlight 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/app/models/spotlight/page.rb +1 -1
- data/app/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb +1 -1
- data/db/migrate/20181127085432_change_weight_on_pages.rb +5 -0
- data/lib/generators/spotlight/templates/catalog_controller.rb +4 -0
- data/lib/spotlight/version.rb +1 -1
- data/spec/examples.txt +1313 -1288
- data/spec/models/spotlight/feature_page_spec.rb +4 -4
- data/spec/views/spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb_spec.rb +20 -2
- metadata +4 -3
@@ -35,9 +35,9 @@ describe Spotlight::FeaturePage, type: :model do
|
|
35
35
|
describe 'weight' do
|
36
36
|
let(:good_weight) { FactoryBot.build(:feature_page, weight: 10, exhibit: exhibit) }
|
37
37
|
let(:low_weight) { FactoryBot.build(:feature_page, weight: -1, exhibit: exhibit) }
|
38
|
-
let(:high_weight) { FactoryBot.build(:feature_page, weight:
|
39
|
-
it 'defaults to
|
40
|
-
expect(described_class.new.weight).to eq
|
38
|
+
let(:high_weight) { FactoryBot.build(:feature_page, weight: 1200, exhibit: exhibit) }
|
39
|
+
it 'defaults to 1000' do
|
40
|
+
expect(described_class.new.weight).to eq 1000
|
41
41
|
end
|
42
42
|
it 'validates when in the 0 to 50 range' do
|
43
43
|
expect(good_weight).to be_valid
|
@@ -48,7 +48,7 @@ describe Spotlight::FeaturePage, type: :model do
|
|
48
48
|
expect(high_weight).to_not be_valid
|
49
49
|
end
|
50
50
|
it 'settable valid maximum' do
|
51
|
-
stub_const('Spotlight::Page::MAX_PAGES',
|
51
|
+
stub_const('Spotlight::Page::MAX_PAGES', 2000)
|
52
52
|
expect(high_weight).to be_valid
|
53
53
|
end
|
54
54
|
end
|
@@ -4,14 +4,20 @@ describe 'spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb',
|
|
4
4
|
SirTrevorRails::Blocks::SolrDocumentsFeaturesBlock.new({ type: 'block', data: { 'show-primary-caption' => true, 'primary-caption-field' => 'x' } }, page)
|
5
5
|
end
|
6
6
|
|
7
|
+
let(:blacklight_config) do
|
8
|
+
Blacklight::Configuration.new do |config|
|
9
|
+
config.index.title_field = 'full_title_tesim'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
7
13
|
before do
|
8
14
|
doc1 = [{}, SolrDocument.new(id: 1, x: 'a' * 100)]
|
9
|
-
doc2 = [{}, SolrDocument.new(id: 2)]
|
15
|
+
doc2 = [{}, SolrDocument.new(id: 2, full_title_tesim: 'full_title')]
|
10
16
|
doc3 = [{}, SolrDocument.new(id: 3)]
|
11
17
|
allow(block).to receive(:each_document).and_return([doc1, doc2, doc3])
|
12
18
|
allow(block).to receive_messages(documents?: true)
|
13
19
|
allow(view).to receive_messages(solr_documents_features_block: block)
|
14
|
-
allow(view).to receive_messages(has_thumbnail?: true, render_thumbnail_tag: 'thumb', blacklight_config:
|
20
|
+
allow(view).to receive_messages(has_thumbnail?: true, render_thumbnail_tag: 'thumb', blacklight_config: blacklight_config)
|
15
21
|
end
|
16
22
|
|
17
23
|
it 'has a slideshow block' do
|
@@ -30,4 +36,16 @@ describe 'spotlight/sir_trevor/blocks/_solr_documents_features_block.html.erb',
|
|
30
36
|
expect(rendered).to have_selector '.carousel-indicators li', count: 3
|
31
37
|
expect(rendered).to have_selector '.carousel-indicators li', text: 'a' * 92 + '...'
|
32
38
|
end
|
39
|
+
|
40
|
+
describe 'without a primary caption' do
|
41
|
+
let(:block) do
|
42
|
+
SirTrevorRails::Blocks::SolrDocumentsFeaturesBlock.new({ type: 'block', data: { 'show-primary-caption' => false } }, page)
|
43
|
+
end
|
44
|
+
|
45
|
+
it 'falls back to the regular document title for the caption' do
|
46
|
+
render partial: p, locals: { item_carousel_block: block }
|
47
|
+
expect(rendered).to have_selector '.item-features'
|
48
|
+
expect(rendered).to have_selector '.carousel-indicators li', text: 'full_title'
|
49
|
+
end
|
50
|
+
end
|
33
51
|
end
|
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.3.
|
4
|
+
version: 2.3.1
|
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-
|
14
|
+
date: 2018-12-19 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rails
|
@@ -1264,6 +1264,7 @@ files:
|
|
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
1266
|
- db/migrate/20180822233601_change_type_of_taggings_taggable.rb
|
1267
|
+
- db/migrate/20181127085432_change_weight_on_pages.rb
|
1267
1268
|
- lib/blacklight/spotlight.rb
|
1268
1269
|
- lib/generators/spotlight/install_generator.rb
|
1269
1270
|
- lib/generators/spotlight/scaffold_resource_generator.rb
|
@@ -1602,7 +1603,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
1602
1603
|
version: '0'
|
1603
1604
|
requirements: []
|
1604
1605
|
rubyforge_project:
|
1605
|
-
rubygems_version: 2.6
|
1606
|
+
rubygems_version: 2.7.6
|
1606
1607
|
signing_key:
|
1607
1608
|
specification_version: 4
|
1608
1609
|
summary: Enable librarians, curators, and others who are responsible for digital collections
|