Skip to content

Commit

Permalink
Use Universal Viewer.
Browse files Browse the repository at this point in the history
This indexes the manifest URL and uses a hosted Universal Viewer.
  • Loading branch information
tpendragon committed Mar 2, 2016
1 parent c73c8d1 commit a37e3fe
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 105 deletions.
6 changes: 6 additions & 0 deletions app/assets/stylesheets/viewer.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.viewer {
height: 400px;
iframe {
position: absolute;
}
}
5 changes: 3 additions & 2 deletions app/controllers/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ class CatalogController < ApplicationController
config.view.masonry.partials = [:index]
config.view.slideshow.partials = [:index]

config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
config.show.partials.insert(1, :openseadragon)
# config.show.tile_source_field = :content_metadata_image_iiif_info_ssm
# config.show.partials.insert(1, :openseadragon)
config.show.partials.insert(1, :universal_viewer)

## Default parameters to send to solr for all search-like requests. See also SolrHelper#solr_search_params
config.default_solr_params = {
Expand Down
2 changes: 1 addition & 1 deletion app/models/collection_manifest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def self.find_by_slug(slug)
def slug
metadata.find do |entry|
entry["label"] == slug_key
end["value"].first["@value"]
end["value"].first
end

private
Expand Down
1 change: 1 addition & 0 deletions app/models/iiif_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def to_solr
super.tap do |solr_doc|
solr_doc['id'] = id
solr_doc[title_field] = manifest['label']
solr_doc['manifest_url_ssm'] = [url]
if manifest['thumbnail']
solr_doc[field_name('thumbnail')] = manifest['thumbnail']['@id']
solr_doc['content_metadata_image_iiif_info_ssm'] = manifest['thumbnail']['@id'].sub(/full.*/, 'info.json')
Expand Down
3 changes: 3 additions & 0 deletions app/views/catalog/_universal_viewer_default.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= javascript_include_tag Pomegranate.config["universal_viewer_url"] %>
<div class="uv viewer" data-uri="<%= document.fetch("manifest_url_ssm").first %>"></div>

1 change: 1 addition & 0 deletions config/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
defaults: &defaults
universal_viewer_url: "http://uv-dev.princeton.edu/lib/embed.js"
all_collection_manifest_url: "https://hydra-dev.princeton.edu/iiif/collections"
events:
server: 'amqp://localhost:5672'
Expand Down
120 changes: 18 additions & 102 deletions spec/cassettes/all_collections.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a37e3fe

Please sign in to comment.