Skip to content

Commit

Permalink
Adding IIIF drag-and-drop icon to item show pages
Browse files Browse the repository at this point in the history
  • Loading branch information
escowles committed Nov 28, 2018
1 parent 314e205 commit fe917c9
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 12 deletions.
Binary file added app/assets/images/iiif.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,13 @@ dd {
}
}
}
img.logo {
margin-left: 100%;
}
h2 {
font-size: 16px;
margin-bottom: 0.75em;
font-weight: bold;
color: $dark-gray;
font-family: $font-serif;
}
4 changes: 4 additions & 0 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ def robots
respond_to :text
expires_in 6.hours, public: true
end

def viewers
respond_to :html
end
end
1 change: 1 addition & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module ApplicationHelper
include Blacklight::BlacklightHelperBehavior
include Spotlight::ApplicationHelper
delegate :url, to: :request, prefix: true

def site_sidebar?
can?(:manage, Spotlight::Site.instance) || can?(:create, Spotlight::Exhibit)
Expand Down
5 changes: 4 additions & 1 deletion app/views/catalog/_universal_viewer_default.html.erb
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<% manifest = document.fetch(Spotlight::Engine.config.iiif_manifest_field).first %>
<div class="uv__overlay" onClick="style.pointerEvents='none'"></div>
<div class="uv viewer" data-config="/uv_config.json" data-uri="<%= document.fetch(Spotlight::Engine.config.iiif_manifest_field).first %>"></div>
<div class="uv viewer" data-config="/uv_config.json" data-uri="<%= manifest %>"></div>
<%= PulUvRails::UniversalViewer.script_tag %>
<%= link_to image_tag("iiif.png", class: "logo", alt: "IIIF Drag and Drop"),
viewers_page_path(manifest: manifest, format: :html) %>
26 changes: 26 additions & 0 deletions app/views/pages/viewers.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<% @page_title = "Viewers" %>
<div class="container-fluid">
<div class="col-xs-12 col-md-10">
<h2>IIIF and Digital Object Viewers</h2>
<p>Digital PUL uses <a href="https://iiif.io/">IIIF</a> (International Image Interoperability Framework)
to share our digital objects. This allows our content to viewed with several different interoperable
viewers, including <a href="http://projectmirador.org/">Mirador</a> and
<a href="https://universalviewer.io/">Universal Viewer</a>.</p>
</div>

<div class="col-xs-12 col-md-10">
<h2>Drag and Drop</h2>
<p>When you see the <%= link_to image_tag("iiif.png", alt: "IIIF"), request_url %> icon, you can drag the
icon into a compatible IIIF viewer to load the object in that viewer. For example, you can open the
<a href="http://projectmirador.org/demo/">Mirador Viewer</a> in another window, and drag the IIIF icon
from Digital PUL (or many other IIIF-enabled sites) to load objects and compare them side-by-side.</p>

<p>Sites that support IIIF drag and drop include
<a href="http://digital.bodleian.ox.ac.uk/inquire/Discover/Search/#/?p=c+,t+ox%5C:collection:Oriental*,rsrs+0,rsps+10,fa+,so+ox%3Asort%5Easc,scids+,pid+,vi+">Digital Bodleian</a>,
<a href="http://www.e-codices.unifr.ch/en/searchresult/list/one/kba/0016-1">e-codices</a>,
<a href="http://www.getty.edu/art/collection/objects/826/vincent-van-gogh-irises-dutch-1889/">The J. Paul Getty Museum</a>,
<a href="https://searchworks.stanford.edu/catalog?f%5Biiif_resources%5D%5B%5D=available">Stanford SearchWorks</a>, and
<a href="http://collections.britishart.yale.edu/vufind/Record/1665373">Yale Center for British Art</a>.
</p>
</div>
</div>
25 changes: 14 additions & 11 deletions app/views/shared/_masthead.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,22 @@
<span class='background-container-gradient'></span>
<% end %>
<% if current_exhibit || content_for?(:masthead) %>
<div class="container site-title-container">
<div class="site-title h1">
<% if content_for? :masthead %>
<%= content_for :masthead %>
<% elsif current_exhibit %>
<%= current_exhibit.title %>
<% if current_exhibit.subtitle.present? %>
<small dir='<%= current_exhibit.subtitle.dir %>'><%= current_exhibit.subtitle %></small>
<% if current_exhibit || content_for?(:masthead) || @page_title %>
<div class="container site-title-container">
<div class="site-title h1">
<% if content_for? :masthead %>
<%= content_for :masthead %>
<% elsif current_exhibit %>
<%= current_exhibit.title %>
<% @subtitle ||= current_exhibit.subtitle %>
<% if @subtitle.present? %>
<small dir='<%= @subtitle.dir %>'><%= @subtitle %></small>
<% end %>
<% elsif @page_title %>
<%= @page_title %>
<% end %>
<% end %>
</div>
</div>
</div>
<% end %>
<%= render 'shared/exhibit_navbar' %>
Expand Down
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
concerns :searchable
end

get '/viewers', to: 'pages#viewers', as: 'viewers_page'
mount Spotlight::Engine, at: '/'

concern :exportable, Blacklight::Routes::Exportable.new
Expand Down
7 changes: 7 additions & 0 deletions spec/controllers/pages_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@
expect(response).to render_template "pages/robots"
end
end

describe "viewers" do
it "renders viewers page" do
get :viewers, params: { format: :html }
expect(response).to render_template "pages/viewers"
end
end
end
15 changes: 15 additions & 0 deletions spec/views/pages/viewers.html.erb_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
require 'rails_helper'

RSpec.describe "pages/viewers.html.erb" do
describe "iiif drag and drop" do
let(:request_url) { "http://example.com/viewers?manifest=abc" }

before do
allow(view).to receive(:request_url).and_return(request_url)
render
end
it "includes a iiif manifest link" do
expect(response).to have_link("IIIF", href: request_url)
end
end
end

0 comments on commit fe917c9

Please sign in to comment.