blacklight-gallery 2.0.1 → 3.0.2
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/README.md +1 -1
- 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 -18
- data/app/assets/stylesheets/blacklight_gallery/_masonry.scss +61 -21
- 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 +4 -4
- data/config/locales/blacklight-gallery.ar.yml +7 -4
- data/lib/blacklight/gallery/engine.rb +0 -1
- data/lib/blacklight/gallery/version.rb +1 -1
- data/lib/generators/blacklight_gallery/install_generator.rb +10 -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 +45 -39
- data/.travis.yml +0 -21
- 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,43 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight-gallery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Beer
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '5.1'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '7'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '5.1'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '7'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: blacklight
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '7.
|
39
|
+
version: '7.12'
|
34
40
|
type: :runtime
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '7.
|
46
|
+
version: '7.12'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: bootstrap
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -52,20 +58,6 @@ dependencies:
|
|
52
58
|
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '4.0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: openseadragon
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: 0.2.0
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: 0.2.0
|
69
61
|
- !ruby/object:Gem::Dependency
|
70
62
|
name: rake
|
71
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -193,7 +185,21 @@ dependencies:
|
|
193
185
|
- !ruby/object:Gem::Version
|
194
186
|
version: '0'
|
195
187
|
- !ruby/object:Gem::Dependency
|
196
|
-
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
|
197
203
|
requirement: !ruby/object:Gem::Requirement
|
198
204
|
requirements:
|
199
205
|
- - ">="
|
@@ -220,16 +226,16 @@ dependencies:
|
|
220
226
|
- - ">="
|
221
227
|
- !ruby/object:Gem::Version
|
222
228
|
version: 3.13.1
|
223
|
-
description:
|
229
|
+
description:
|
224
230
|
email:
|
225
231
|
- cabeer@stanford.edu
|
226
232
|
executables: []
|
227
233
|
extensions: []
|
228
234
|
extra_rdoc_files: []
|
229
235
|
files:
|
236
|
+
- ".github/workflows/ruby.yml"
|
230
237
|
- ".gitignore"
|
231
238
|
- ".solr_wrapper.yml"
|
232
|
-
- ".travis.yml"
|
233
239
|
- Gemfile
|
234
240
|
- LICENSE.txt
|
235
241
|
- README.md
|
@@ -254,19 +260,19 @@ files:
|
|
254
260
|
- app/assets/stylesheets/blacklight_gallery/_osd_viewer.scss
|
255
261
|
- app/assets/stylesheets/blacklight_gallery/_slideshow.scss
|
256
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
|
257
269
|
- app/helpers/blacklight/gallery_helper.rb
|
258
270
|
- app/helpers/blacklight/openseadragon_helper.rb
|
259
271
|
- app/models/concerns/blacklight/gallery/openseadragon_solr_document.rb
|
260
272
|
- app/views/catalog/_document_gallery.html.erb
|
261
273
|
- app/views/catalog/_document_masonry.html.erb
|
262
274
|
- app/views/catalog/_document_slideshow.html.erb
|
263
|
-
- app/views/catalog/_grid_slideshow.html.erb
|
264
|
-
- app/views/catalog/_index_gallery.html.erb
|
265
|
-
- app/views/catalog/_index_masonry.html.erb
|
266
|
-
- app/views/catalog/_index_masonry_default.html.erb
|
267
|
-
- app/views/catalog/_index_slideshow.html.erb
|
268
275
|
- app/views/catalog/_openseadragon_default.html.erb
|
269
|
-
- app/views/catalog/_slideshow.html.erb
|
270
276
|
- app/views/catalog/_slideshow_modal.html.erb
|
271
277
|
- blacklight-gallery.gemspec
|
272
278
|
- config/locales/blacklight-gallery.ar.yml
|
@@ -299,17 +305,17 @@ files:
|
|
299
305
|
- solr/conf/xslt/example_atom.xsl
|
300
306
|
- solr/conf/xslt/example_rss.xsl
|
301
307
|
- solr/conf/xslt/luke.xsl
|
308
|
+
- spec/components/blacklight/gallery/document_component_spec.rb
|
309
|
+
- spec/components/blacklight/gallery/slideshow_component_spec.rb
|
302
310
|
- spec/features/gallery_spec.rb
|
303
311
|
- spec/features/masonry_spec.rb
|
304
312
|
- spec/features/slideshow_spec.rb
|
305
|
-
- spec/
|
313
|
+
- spec/fixtures/sample_solr_documents.yml
|
306
314
|
- spec/models/concerns/openseadragon_solr_document_spec.rb
|
307
315
|
- spec/spec_helper.rb
|
308
316
|
- spec/test_app_templates/Gemfile.extra
|
309
317
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
310
318
|
- spec/views/catalog/_document_slideshow.html.erb_spec.rb
|
311
|
-
- spec/views/catalog/_index_gallery.html.erb_spec.rb
|
312
|
-
- spec/views/catalog/_index_masonry.html.erb_spec.rb
|
313
319
|
- spec/views/catalog/_openseadragon_default.html.erb_spec.rb
|
314
320
|
- vendor/assets/javascripts/imagesloaded.min.js
|
315
321
|
- vendor/assets/javascripts/masonry.min.js
|
@@ -317,7 +323,7 @@ homepage: https://github.com/projectblacklight/blacklight-gallery
|
|
317
323
|
licenses:
|
318
324
|
- Apache 2.0
|
319
325
|
metadata: {}
|
320
|
-
post_install_message:
|
326
|
+
post_install_message:
|
321
327
|
rdoc_options: []
|
322
328
|
require_paths:
|
323
329
|
- lib
|
@@ -332,20 +338,20 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
332
338
|
- !ruby/object:Gem::Version
|
333
339
|
version: '0'
|
334
340
|
requirements: []
|
335
|
-
rubygems_version: 3.
|
336
|
-
signing_key:
|
341
|
+
rubygems_version: 3.2.3
|
342
|
+
signing_key:
|
337
343
|
specification_version: 4
|
338
344
|
summary: Gallery display for Blacklight
|
339
345
|
test_files:
|
346
|
+
- spec/components/blacklight/gallery/document_component_spec.rb
|
347
|
+
- spec/components/blacklight/gallery/slideshow_component_spec.rb
|
340
348
|
- spec/features/gallery_spec.rb
|
341
349
|
- spec/features/masonry_spec.rb
|
342
350
|
- spec/features/slideshow_spec.rb
|
343
|
-
- spec/
|
351
|
+
- spec/fixtures/sample_solr_documents.yml
|
344
352
|
- spec/models/concerns/openseadragon_solr_document_spec.rb
|
345
353
|
- spec/spec_helper.rb
|
346
354
|
- spec/test_app_templates/Gemfile.extra
|
347
355
|
- spec/test_app_templates/lib/generators/test_app_generator.rb
|
348
356
|
- spec/views/catalog/_document_slideshow.html.erb_spec.rb
|
349
|
-
- spec/views/catalog/_index_gallery.html.erb_spec.rb
|
350
|
-
- spec/views/catalog/_index_masonry.html.erb_spec.rb
|
351
357
|
- spec/views/catalog/_openseadragon_default.html.erb_spec.rb
|
data/.travis.yml
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
sudo: false
|
3
|
-
|
4
|
-
notifications:
|
5
|
-
email: false
|
6
|
-
|
7
|
-
rvm:
|
8
|
-
- 2.5.3
|
9
|
-
- 2.6.0
|
10
|
-
|
11
|
-
notifications:
|
12
|
-
irc: "irc.freenode.org#blacklight"
|
13
|
-
email:
|
14
|
-
- blacklight-commits@googlegroups.com
|
15
|
-
|
16
|
-
env:
|
17
|
-
global:
|
18
|
-
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
19
|
-
- RAILS_VERSION='5.2.3'
|
20
|
-
|
21
|
-
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-6 col-md-4">
|
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
|