Skip to content

Commit

Permalink
blacklight-gallery: add slideshow_method to render large images
Browse files Browse the repository at this point in the history
  • Loading branch information
dunn committed Aug 15, 2017
1 parent fb8265d commit 4863b24
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gem "therubyracer", "~> 0.12.3", platforms: :ruby

gem "active-fedora", "~> 11.0.0"
gem "active-triples", "~> 0.11.0"
gem "blacklight-gallery", "~> 0.5.0"
gem "blacklight-gallery", "~> 0.8.0"
gem "blacklight_range_limit", "~> 6.1.2"
gem "curation_concerns", "~> 1.7.7"
gem "ezid-client", "~> 1.2"
Expand Down
13 changes: 7 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ GEM
american_date (1.1.1)
arel (7.1.4)
ast (2.3.0)
autoprefixer-rails (7.1.2.3)
autoprefixer-rails (7.1.2.6)
execjs
awesome_nested_set (3.1.3)
activerecord (>= 4.0.0, < 5.2)
Expand All @@ -116,10 +116,11 @@ GEM
execjs (~> 2.0)
bcp47 (0.3.3)
i18n
blacklight (6.10.1)
blacklight (6.11.0)
bootstrap-sass (~> 3.2)
deprecation
globalid
jbuilder
kaminari (>= 0.15)
nokogiri (~> 1.6)
rails (>= 4.2, < 6)
Expand All @@ -129,8 +130,8 @@ GEM
blacklight (~> 6.0)
cancancan (~> 1.8)
deprecation (~> 1.0)
blacklight-gallery (0.5.0)
blacklight (> 6.0.0.pre, < 7)
blacklight-gallery (0.8.0)
blacklight (~> 6.3)
bootstrap-sass (~> 3.0)
openseadragon (>= 0.2.0)
rails
Expand Down Expand Up @@ -484,7 +485,7 @@ GEM
activesupport
nokogiri (>= 1.4.2)
solrizer (~> 3.3)
openseadragon (0.3.3)
openseadragon (0.4.0)
rails (> 3.2.0)
os (0.9.6)
parallel (1.12.0)
Expand Down Expand Up @@ -800,7 +801,7 @@ DEPENDENCIES
active-triples (~> 0.11.0)
american_date (~> 1.1.0)
awesome_print
blacklight-gallery (~> 0.5.0)
blacklight-gallery (~> 0.8.0)
blacklight_range_limit (~> 6.1.2)
byebug
capistrano (~> 3.8.0)
Expand Down
8 changes: 4 additions & 4 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,11 @@ def collection?(_config, document)
document.collection?
end

def show_contributors?(_config, document)
!document.etd?
end

def show_author?(_config, document)
document.etd?
end

def show_contributors?(_config, document)
!document.etd?
end
end
1 change: 1 addition & 0 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def enforce_show_permissions(_opts = {})
config.search_builder_class = SearchBuilder
config.view.gallery.partials = [:index_header, :index]
config.view.slideshow.partials = [:index]
config.view.slideshow.slideshow_method = :choose_image

# config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
# config.show.partials.insert(1, :openseadragon)
Expand Down
22 changes: 22 additions & 0 deletions config/initializers/slideshow_method.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# frozen_string_literal: true

module Blacklight::GalleryHelper
WITH_LARGE_IMAGES = %w[
Image
ComponentMap
IndexMap
ScannedMap
].freeze

def choose_image(document, options)
if WITH_LARGE_IMAGES.include? document["has_model_ssim"].first
image_tag(document["image_url_ssm"].first, options)
else
render_thumbnail_tag(
document,
options,
url_options.reverse_merge(suppress_link: true)
)
end
end
end
2 changes: 1 addition & 1 deletion spec/indexers/component_map_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
)

expect(subject[ObjectIndexer.thumbnail_field]).to(
eq ["/image-service/s1%2F78%2F4k%2F72%2Fs1784k724%2Ffiles%2F6185235a-79b2-4c29-8c24-4d6ad9b11470/full/300,/0/default.jpg"]
eq ["/image-service/s1%2F78%2F4k%2F72%2Fs1784k724%2Ffiles%2F6185235a-79b2-4c29-8c24-4d6ad9b11470/square/100,/0/default.jpg"]
)

expect(subject["image_url_ssm"]).to(
Expand Down
2 changes: 1 addition & 1 deletion spec/indexers/image_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
VCR.use_cassette("image_indexer") do
# rubocop:disable Metrics/LineLength
expect(subject[ObjectIndexer.thumbnail_field]).to(
eq ["/image-service/s1%2F78%2F4k%2F72%2Fs1784k724%2Ffiles%2F6185235a-79b2-4c29-8c24-4d6ad9b11470/full/300,/0/default.jpg"]
eq ["/image-service/s1%2F78%2F4k%2F72%2Fs1784k724%2Ffiles%2F6185235a-79b2-4c29-8c24-4d6ad9b11470/square/100,/0/default.jpg"]
)

expect(subject["image_url_ssm"]).to(
Expand Down
2 changes: 1 addition & 1 deletion spec/indexers/index_map_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
)

expect(subject[ObjectIndexer.thumbnail_field]).to(
eq ["/image-service/s1%2F78%2F4k%2F72%2Fs1784k724%2Ffiles%2F6185235a-79b2-4c29-8c24-4d6ad9b11470/full/300,/0/default.jpg"]
eq ["/image-service/s1%2F78%2F4k%2F72%2Fs1784k724%2Ffiles%2F6185235a-79b2-4c29-8c24-4d6ad9b11470/square/100,/0/default.jpg"]
)

expect(subject["image_url_ssm"]).to(
Expand Down
2 changes: 1 addition & 1 deletion spec/indexers/scanned_map_indexer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
VCR.use_cassette("scanned_map_indexer") do
# rubocop:disable Metrics/LineLength
expect(subject[ObjectIndexer.thumbnail_field]).to(
eq ["/image-service/s1%2F78%2F4k%2F72%2Fs1784k724%2Ffiles%2F6185235a-79b2-4c29-8c24-4d6ad9b11470/full/300,/0/default.jpg"]
eq ["/image-service/s1%2F78%2F4k%2F72%2Fs1784k724%2Ffiles%2F6185235a-79b2-4c29-8c24-4d6ad9b11470/square/100,/0/default.jpg"]
)

expect(subject["image_url_ssm"]).to(
Expand Down
2 changes: 1 addition & 1 deletion spec/views/collections/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
allow(view).to receive(:render_index_doc_actions).and_return nil
allow(controller). to receive(:show_contributors?).and_return false
allow(controller). to receive(:show_author?).and_return false
# allow(controller).to receive(:show_type?).and_return(false)
allow(controller).to receive(:collection?).and_return(true)
view.lookup_context.prefixes += ["catalog"]
assign(:response, response)
assign(:presenter, presenter)
Expand Down

0 comments on commit 4863b24

Please sign in to comment.