blacklight-gallery 2.1.0 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +45 -0
- data/app/assets/javascripts/blacklight_gallery/default.js +0 -1
- data/app/assets/javascripts/blacklight_gallery/masonry.js +1 -1
- data/app/assets/javascripts/blacklight_gallery/osd_viewer.js +1 -1
- data/app/assets/javascripts/blacklight_gallery/slideshow.js +1 -2
- data/app/assets/stylesheets/blacklight_gallery/_gallery.scss +8 -3
- data/app/assets/stylesheets/blacklight_gallery/_masonry.scss +60 -22
- data/app/assets/stylesheets/blacklight_gallery/_slideshow.scss +5 -3
- data/app/components/blacklight/gallery/document_component.html.erb +21 -0
- data/app/components/blacklight/gallery/document_component.rb +11 -0
- data/app/components/blacklight/gallery/slideshow_component.html.erb +12 -0
- data/app/components/blacklight/gallery/slideshow_component.rb +40 -0
- data/app/components/blacklight/gallery/slideshow_preview_component.html.erb +5 -0
- data/app/components/blacklight/gallery/slideshow_preview_component.rb +28 -0
- data/app/helpers/blacklight/gallery_helper.rb +0 -38
- data/app/models/concerns/blacklight/gallery/openseadragon_solr_document.rb +1 -1
- data/app/views/catalog/_document_gallery.html.erb +4 -3
- data/app/views/catalog/_document_masonry.html.erb +2 -3
- data/app/views/catalog/_document_slideshow.html.erb +26 -5
- data/app/views/catalog/_slideshow_modal.html.erb +2 -3
- data/blacklight-gallery.gemspec +3 -3
- data/lib/blacklight/gallery/engine.rb +0 -1
- data/lib/blacklight/gallery/version.rb +1 -1
- data/lib/generators/blacklight_gallery/install_generator.rb +9 -3
- data/lib/generators/blacklight_gallery/templates/blacklight_gallery.js +2 -1
- data/spec/components/blacklight/gallery/document_component_spec.rb +46 -0
- data/spec/components/blacklight/gallery/slideshow_component_spec.rb +67 -0
- data/spec/features/gallery_spec.rb +3 -4
- data/spec/features/masonry_spec.rb +2 -3
- data/spec/features/slideshow_spec.rb +0 -2
- data/spec/fixtures/sample_solr_documents.yml +2495 -0
- data/spec/models/concerns/openseadragon_solr_document_spec.rb +1 -1
- data/spec/spec_helper.rb +4 -11
- data/spec/views/catalog/_document_slideshow.html.erb_spec.rb +15 -5
- metadata +33 -33
- data/.travis.yml +0 -38
- data/app/views/catalog/_grid_slideshow.html.erb +0 -11
- data/app/views/catalog/_index_gallery.html.erb +0 -14
- data/app/views/catalog/_index_masonry.html.erb +0 -8
- data/app/views/catalog/_index_masonry_default.html.erb +0 -1
- data/app/views/catalog/_index_slideshow.html.erb +0 -11
- data/app/views/catalog/_slideshow.html.erb +0 -23
- data/spec/helpers/blacklight/gallery_helper_spec.rb +0 -110
- data/spec/views/catalog/_index_gallery.html.erb_spec.rb +0 -22
- data/spec/views/catalog/_index_masonry.html.erb_spec.rb +0 -34
@@ -13,7 +13,7 @@ describe Blacklight::Gallery::OpenseadragonSolrDocument do
|
|
13
13
|
|
14
14
|
context 'when not configured for the view' do
|
15
15
|
let(:fields) { { some_field: 'data' } }
|
16
|
-
let(:view_config) { double('ViewConfig') }
|
16
|
+
let(:view_config) { double('ViewConfig', tile_source_field: nil) }
|
17
17
|
it 'returns nil' do
|
18
18
|
expect(subject).to be_nil
|
19
19
|
end
|
data/spec/spec_helper.rb
CHANGED
@@ -9,19 +9,11 @@ require 'rspec/rails'
|
|
9
9
|
require 'rspec/active_model/mocks'
|
10
10
|
|
11
11
|
require 'selenium-webdriver'
|
12
|
-
require '
|
12
|
+
require 'webdrivers'
|
13
13
|
|
14
|
-
Capybara.javascript_driver = :headless_chrome
|
15
14
|
|
16
|
-
Capybara.
|
17
|
-
|
18
|
-
chromeOptions: { args: %w[headless disable-gpu no-sandbox] }
|
19
|
-
)
|
20
|
-
|
21
|
-
Capybara::Selenium::Driver.new(app,
|
22
|
-
browser: :chrome,
|
23
|
-
desired_capabilities: capabilities)
|
24
|
-
end
|
15
|
+
Capybara.javascript_driver = :selenium_chrome_headless
|
16
|
+
Capybara.disable_animation = true
|
25
17
|
|
26
18
|
require 'blacklight'
|
27
19
|
require 'blacklight/gallery'
|
@@ -29,5 +21,6 @@ require 'blacklight/gallery'
|
|
29
21
|
RSpec.configure do |c|
|
30
22
|
c.infer_spec_type_from_file_location!
|
31
23
|
c.full_backtrace = true
|
24
|
+
c.include ViewComponent::TestHelpers, type: :component
|
32
25
|
#onfig.assets.precompile += %w(spotlight/default_thumbnail.jpg spotlight/default_browse_thumbnail.jpg)
|
33
26
|
end
|
@@ -1,17 +1,27 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe "catalog/_document_slideshow.html.erb", :type => :view do
|
4
|
-
let(:blacklight_config)
|
4
|
+
let(:blacklight_config) do
|
5
|
+
Blacklight::Configuration.new do |config|
|
6
|
+
config.track_search_session = false
|
7
|
+
end
|
8
|
+
end
|
5
9
|
|
6
10
|
let(:document) { stub_model(::SolrDocument) }
|
7
11
|
|
8
12
|
before do
|
9
|
-
allow(view).to receive_messages(
|
10
|
-
|
11
|
-
|
13
|
+
allow(view).to receive_messages(
|
14
|
+
blacklight_config: blacklight_config,
|
15
|
+
documents: [document],
|
16
|
+
document_index_view_type: 'slideshow',
|
17
|
+
document_counter_with_offset: 1
|
18
|
+
)
|
19
|
+
allow(view).to receive(:current_search_session).and_return(nil)
|
20
|
+
allow(view).to receive(:search_session).and_return({})
|
21
|
+
allow(view).to receive(:search_state).and_return(Blacklight::SearchState.new({}, blacklight_config))
|
12
22
|
end
|
13
23
|
|
14
|
-
it
|
24
|
+
it 'has a modal' do
|
15
25
|
render
|
16
26
|
expect(rendered).to have_selector '#slideshow-modal'
|
17
27
|
expect(rendered).to have_selector '[data-slide="prev"]'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight-gallery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -36,14 +36,14 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '7.
|
39
|
+
version: '7.12'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
44
|
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '7.
|
46
|
+
version: '7.12'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: bootstrap
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,20 +58,6 @@ dependencies:
|
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '4.0'
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: openseadragon
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - ">="
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: 0.2.0
|
68
|
-
type: :runtime
|
69
|
-
prerelease: false
|
70
|
-
version_requirements: !ruby/object:Gem::Requirement
|
71
|
-
requirements:
|
72
|
-
- - ">="
|
73
|
-
- !ruby/object:Gem::Version
|
74
|
-
version: 0.2.0
|
75
61
|
- !ruby/object:Gem::Dependency
|
76
62
|
name: rake
|
77
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -199,7 +185,21 @@ dependencies:
|
|
199
185
|
- !ruby/object:Gem::Version
|
200
186
|
version: '0'
|
201
187
|
- !ruby/object:Gem::Dependency
|
202
|
-
name:
|
188
|
+
name: webdrivers
|
189
|
+
requirement: !ruby/object:Gem::Requirement
|
190
|
+
requirements:
|
191
|
+
- - ">="
|
192
|
+
- !ruby/object:Gem::Version
|
193
|
+
version: '0'
|
194
|
+
type: :development
|
195
|
+
prerelease: false
|
196
|
+
version_requirements: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
- !ruby/object:Gem::Dependency
|
202
|
+
name: rexml
|
203
203
|
requirement: !ruby/object:Gem::Requirement
|
204
204
|
requirements:
|
205
205
|
- - ">="
|
@@ -233,9 +233,9 @@ executables: []
|
|
233
233
|
extensions: []
|
234
234
|
extra_rdoc_files: []
|
235
235
|
files:
|
236
|
+
- ".github/workflows/ruby.yml"
|
236
237
|
- ".gitignore"
|
237
238
|
- ".solr_wrapper.yml"
|
238
|
-
- ".travis.yml"
|
239
239
|
- Gemfile
|
240
240
|
- LICENSE.txt
|
241
241
|
- README.md
|
@@ -260,19 +260,19 @@ files:
|
|
260
260
|
- app/assets/stylesheets/blacklight_gallery/_osd_viewer.scss
|
261
261
|
- app/assets/stylesheets/blacklight_gallery/_slideshow.scss
|
262
262
|
- app/assets/stylesheets/blacklight_gallery/default.scss
|
263
|
+
- app/components/blacklight/gallery/document_component.html.erb
|
264
|
+
- app/components/blacklight/gallery/document_component.rb
|
265
|
+
- app/components/blacklight/gallery/slideshow_component.html.erb
|
266
|
+
- app/components/blacklight/gallery/slideshow_component.rb
|
267
|
+
- app/components/blacklight/gallery/slideshow_preview_component.html.erb
|
268
|
+
- app/components/blacklight/gallery/slideshow_preview_component.rb
|
263
269
|
- app/helpers/blacklight/gallery_helper.rb
|
264
270
|
- app/helpers/blacklight/openseadragon_helper.rb
|
265
271
|
- app/models/concerns/blacklight/gallery/openseadragon_solr_document.rb
|
266
272
|
- app/views/catalog/_document_gallery.html.erb
|
267
273
|
- app/views/catalog/_document_masonry.html.erb
|
268
274
|
- app/views/catalog/_document_slideshow.html.erb
|
269
|
-
- app/views/catalog/_grid_slideshow.html.erb
|
270
|
-
- app/views/catalog/_index_gallery.html.erb
|
271
|
-
- app/views/catalog/_index_masonry.html.erb
|
272
|
-
- app/views/catalog/_index_masonry_default.html.erb
|
273
|
-
- app/views/catalog/_index_slideshow.html.erb
|
274
275
|
- app/views/catalog/_openseadragon_default.html.erb
|
275
|
-
- app/views/catalog/_slideshow.html.erb
|
276
276
|
- app/views/catalog/_slideshow_modal.html.erb
|
277
277
|
- blacklight-gallery.gemspec
|
278
278
|
- config/locales/blacklight-gallery.ar.yml
|
@@ -305,17 +305,17 @@ files:
|
|
305
305
|
- solr/conf/xslt/example_atom.xsl
|
306
306
|
- solr/conf/xslt/example_rss.xsl
|
307
307
|
- solr/conf/xslt/luke.xsl
|
308
|
+
- spec/components/blacklight/gallery/document_component_spec.rb
|
309
|
+
- spec/components/blacklight/gallery/slideshow_component_spec.rb
|
308
310
|
- spec/features/gallery_spec.rb
|
309
311
|
- spec/features/masonry_spec.rb
|
310
312
|
- spec/features/slideshow_spec.rb
|
311
|
-
- spec/
|
313
|
+
- spec/fixtures/sample_solr_documents.yml
|
312
314
|
- spec/models/concerns/openseadragon_solr_document_spec.rb
|
313
315
|
- spec/spec_helper.rb
|
314
316
|
- spec/test_app_templates/Gemfile.extra
|
315
317
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
316
318
|
- spec/views/catalog/_document_slideshow.html.erb_spec.rb
|
317
|
-
- spec/views/catalog/_index_gallery.html.erb_spec.rb
|
318
|
-
- spec/views/catalog/_index_masonry.html.erb_spec.rb
|
319
319
|
- spec/views/catalog/_openseadragon_default.html.erb_spec.rb
|
320
320
|
- vendor/assets/javascripts/imagesloaded.min.js
|
321
321
|
- vendor/assets/javascripts/masonry.min.js
|
@@ -338,20 +338,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
338
338
|
- !ruby/object:Gem::Version
|
339
339
|
version: '0'
|
340
340
|
requirements: []
|
341
|
-
rubygems_version: 3.1.
|
341
|
+
rubygems_version: 3.1.4
|
342
342
|
signing_key:
|
343
343
|
specification_version: 4
|
344
344
|
summary: Gallery display for Blacklight
|
345
345
|
test_files:
|
346
|
+
- spec/components/blacklight/gallery/document_component_spec.rb
|
347
|
+
- spec/components/blacklight/gallery/slideshow_component_spec.rb
|
346
348
|
- spec/features/gallery_spec.rb
|
347
349
|
- spec/features/masonry_spec.rb
|
348
350
|
- spec/features/slideshow_spec.rb
|
349
|
-
- spec/
|
351
|
+
- spec/fixtures/sample_solr_documents.yml
|
350
352
|
- spec/models/concerns/openseadragon_solr_document_spec.rb
|
351
353
|
- spec/spec_helper.rb
|
352
354
|
- spec/test_app_templates/Gemfile.extra
|
353
355
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
354
356
|
- spec/views/catalog/_document_slideshow.html.erb_spec.rb
|
355
|
-
- spec/views/catalog/_index_gallery.html.erb_spec.rb
|
356
|
-
- spec/views/catalog/_index_masonry.html.erb_spec.rb
|
357
357
|
- spec/views/catalog/_openseadragon_default.html.erb_spec.rb
|
data/.travis.yml
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
dist: bionic
|
4
|
-
|
5
|
-
addons:
|
6
|
-
chrome: stable
|
7
|
-
|
8
|
-
before_install:
|
9
|
-
- google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=9222 http://localhost &
|
10
|
-
|
11
|
-
notifications:
|
12
|
-
email: false
|
13
|
-
|
14
|
-
notifications:
|
15
|
-
irc: "irc.freenode.org#blacklight"
|
16
|
-
email:
|
17
|
-
- blacklight-commits@googlegroups.com
|
18
|
-
|
19
|
-
env:
|
20
|
-
global:
|
21
|
-
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
22
|
-
- ENGINE_CART_RAILS_OPTIONS='--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
|
23
|
-
|
24
|
-
matrix:
|
25
|
-
include:
|
26
|
-
- rvm: 2.7.1
|
27
|
-
env: "RAILS_VERSION=6.0.3.1"
|
28
|
-
- rvm: 2.6.6
|
29
|
-
env: "RAILS_VERSION=6.0.3.1"
|
30
|
-
- rvm: 2.6.6
|
31
|
-
env: "RAILS_VERSION=5.2.4.3"
|
32
|
-
- rvm: 2.5.8
|
33
|
-
env: "RAILS_VERSION=5.2.4.3"
|
34
|
-
- rvm: 2.4.9
|
35
|
-
env: "RAILS_VERSION=5.2.4.3"
|
36
|
-
fast_finish: true
|
37
|
-
|
38
|
-
jdk: openjdk11
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<div class="document">
|
2
|
-
<div class="thumbnail">
|
3
|
-
<%= link_to '#', data: { :'slide-to' => document_counter, toggle: "modal", target: "#slideshow-modal" } do %>
|
4
|
-
<% if thumbnail_url(document) %>
|
5
|
-
<%= image_tag thumbnail_url(document), class: 'img-thumbnail', alt: index_presenter(document).heading %>
|
6
|
-
<% else %>
|
7
|
-
<%= t('.missing_image', scope: [:blacklight_gallery]) %>
|
8
|
-
<% end %>
|
9
|
-
<% end %>
|
10
|
-
</div>
|
11
|
-
</div>
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<div class="document col">
|
2
|
-
<div class="thumbnail">
|
3
|
-
<%= render_thumbnail_tag(
|
4
|
-
document,
|
5
|
-
{ class: 'img-thumbnail', alt: '' },
|
6
|
-
counter: document_counter_with_offset(document_counter),
|
7
|
-
'aria-hidden': true,
|
8
|
-
tabindex: -1
|
9
|
-
) %>
|
10
|
-
<div class="caption">
|
11
|
-
<%= render_document_partials document, blacklight_config.view_config(:gallery).partials, :document_counter => document_counter %>
|
12
|
-
</div>
|
13
|
-
</div>
|
14
|
-
</div>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<div class="masonry document col-6 col-md-3">
|
2
|
-
<div class="thumbnail">
|
3
|
-
<%= render_thumbnail_tag(document, { class: 'img-thumbnail', alt: index_presenter(document).heading }, counter: document_counter_with_offset(document_counter)) %>
|
4
|
-
<div class="caption">
|
5
|
-
<%= render_document_partials document, blacklight_config.view_config(:masonry).partials, :document_counter => document_counter %>
|
6
|
-
</div>
|
7
|
-
</div>
|
8
|
-
</div>
|
@@ -1 +0,0 @@
|
|
1
|
-
<%= link_to_document(document, truncate(index_presenter(document).label(document_show_link_field(document)), length: 89)) %>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
<div class="item<%= ' active' if document_counter == 0 %>">
|
2
|
-
<div class="frame">
|
3
|
-
<%= render_slideshow_tag(document, { alt: '' }) %>
|
4
|
-
<div class="caption">
|
5
|
-
<%= index_presenter(document).label(document_show_link_field(document)) %>
|
6
|
-
</div>
|
7
|
-
<span class="counter">
|
8
|
-
<%= t :'blacklight_gallery.catalog.modal_slideshow.counter', counter: document_counter + 1, count: count %>
|
9
|
-
</span>
|
10
|
-
</div>
|
11
|
-
</div>
|
@@ -1,23 +0,0 @@
|
|
1
|
-
<div id="slideshow" class="slideshow-presenter">
|
2
|
-
<!-- Wrapper for slides -->
|
3
|
-
<div class="slideshow-inner">
|
4
|
-
<%= render collection: documents, as: :document, partial: 'index_slideshow', locals: {count: documents.count} %>
|
5
|
-
</div>
|
6
|
-
|
7
|
-
<!-- Controls -->
|
8
|
-
<a class="left carousel-control prev" href="#slideshow" data-slide="prev">
|
9
|
-
<%= blacklight_icon 'chevron_left', { additional_options: { label_context: 'previous_image' }} %>
|
10
|
-
</a>
|
11
|
-
<a class="right carousel-control next" href="#slideshow" data-slide="next">
|
12
|
-
<%= blacklight_icon 'chevron_right', { additional_options: { label_context: 'next_image' }} %>
|
13
|
-
</a>
|
14
|
-
|
15
|
-
<div class="controls text-center">
|
16
|
-
<button class="btn btn-sm btn-link" data-behavior="pause-slideshow" aria-label="<%= t('blacklight_gallery.catalog.slideshow.pause') %>">
|
17
|
-
<%= blacklight_icon 'pause_slideshow' %>
|
18
|
-
</button>
|
19
|
-
<button class="btn btn-sm btn-link" data-behavior="start-slideshow" aria-label="<%= t('blacklight_gallery.catalog.slideshow.start') %>">
|
20
|
-
<%= blacklight_icon 'start_slideshow' %>
|
21
|
-
</button>
|
22
|
-
</div>
|
23
|
-
</div>
|
@@ -1,110 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Blacklight::GalleryHelper, :type => :helper do
|
4
|
-
before do
|
5
|
-
allow(helper).to receive(:blacklight_configuration_context).and_return(double(evaluate_if_unless_configuration: true))
|
6
|
-
end
|
7
|
-
describe "#render_gallery_collection" do
|
8
|
-
let(:template) { double }
|
9
|
-
before do
|
10
|
-
allow(template).to receive(:render).and_return("hello ")
|
11
|
-
allow(helper).to receive(:gallery_wrapper_template).and_return(template)
|
12
|
-
end
|
13
|
-
let(:documents) { [ double, double] }
|
14
|
-
subject { helper.render_gallery_collection documents}
|
15
|
-
|
16
|
-
it { is_expected.to eq 'hello hello ' }
|
17
|
-
end
|
18
|
-
|
19
|
-
describe "#gallery_wrapper_template" do
|
20
|
-
before do
|
21
|
-
allow(helper).to receive(:blacklight_config).and_return(CatalogController.blacklight_config)
|
22
|
-
helper.lookup_context.prefixes << "catalog"
|
23
|
-
end
|
24
|
-
|
25
|
-
subject { helper.gallery_wrapper_template SolrDocument.new }
|
26
|
-
|
27
|
-
it "should be the default template" do
|
28
|
-
expect(subject.virtual_path).to eq 'catalog/_index_gallery'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
describe "render_slideshow_tag" do
|
33
|
-
let(:document) { instance_double(SolrDocument) }
|
34
|
-
|
35
|
-
it "calls the provided slideshow method" do
|
36
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_method = :xyz })
|
37
|
-
expect(helper).to receive_messages(:xyz => "some-slideshow")
|
38
|
-
expect(helper.render_slideshow_tag(document)).to eq 'some-slideshow'
|
39
|
-
end
|
40
|
-
|
41
|
-
it "creates an image tag from the given field" do
|
42
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_field = :xyz })
|
43
|
-
|
44
|
-
allow(document).to receive(:has?).with(:xyz).and_return(true)
|
45
|
-
allow(document).to receive(:first).with(:xyz).and_return("http://example.com/some.jpg")
|
46
|
-
expect(helper.render_slideshow_tag(document)).to match /img/
|
47
|
-
end
|
48
|
-
|
49
|
-
it "does not link to the document if the url options are false" do
|
50
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_method = :xyz })
|
51
|
-
allow(helper).to receive_messages(:xyz => "some-slideshow")
|
52
|
-
|
53
|
-
result = helper.render_slideshow_tag document, {}, false
|
54
|
-
expect(result).to eq "some-slideshow"
|
55
|
-
end
|
56
|
-
|
57
|
-
it "does not link to the document if the url options have :suppress_link" do
|
58
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_method = :xyz })
|
59
|
-
allow(helper).to receive_messages(:xyz => "some-slideshow")
|
60
|
-
|
61
|
-
result = helper.render_slideshow_tag document, {}, suppress_link: true
|
62
|
-
expect(result).to eq "some-slideshow"
|
63
|
-
end
|
64
|
-
|
65
|
-
|
66
|
-
it "returns nil if no slideshow is available" do
|
67
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new)
|
68
|
-
expect(helper.render_slideshow_tag document).to be_nil
|
69
|
-
end
|
70
|
-
|
71
|
-
it "returns nil if no slideshow is returned from the slideshow method" do
|
72
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_method = :xyz })
|
73
|
-
allow(helper).to receive_messages(:xyz => nil)
|
74
|
-
|
75
|
-
expect(helper.render_slideshow_tag document).to be_nil
|
76
|
-
end
|
77
|
-
|
78
|
-
it "returns nil if no slideshow is in the document" do
|
79
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_field = :xyz })
|
80
|
-
|
81
|
-
allow(document).to receive(:has?).with(:xyz).and_return(false)
|
82
|
-
|
83
|
-
expect(helper.render_slideshow_tag document).to be_nil
|
84
|
-
end
|
85
|
-
|
86
|
-
it "falls back to a thumbnail" do
|
87
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.thumbnail_method = :xyz })
|
88
|
-
allow(helper).to receive(:xyz).and_return('thumbnail-image')
|
89
|
-
|
90
|
-
expect(helper.render_slideshow_tag document).to eq 'thumbnail-image'
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe "slideshow_url" do
|
95
|
-
it "pulls the configured slideshow field out of the document" do
|
96
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_field = :xyz })
|
97
|
-
document = instance_double(SolrDocument)
|
98
|
-
allow(document).to receive(:has?).with(:xyz).and_return(true)
|
99
|
-
allow(document).to receive(:first).with(:xyz).and_return("asdf")
|
100
|
-
expect(helper.slideshow_image_url document).to eq("asdf")
|
101
|
-
end
|
102
|
-
|
103
|
-
it "returns nil if the slideshow field doesn't exist" do
|
104
|
-
allow(helper).to receive_messages(:blacklight_config => Blacklight::Configuration.new.tap { |config| config.index.slideshow_field = :xyz })
|
105
|
-
document = instance_double(SolrDocument)
|
106
|
-
allow(document).to receive(:has?).with(:xyz).and_return(false)
|
107
|
-
expect(helper.slideshow_image_url document).to be_nil
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|