Skip to content

Commit

Permalink
adds iiif drag n drop to show page for Mirador viewed images
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Oct 10, 2017
1 parent 216bb32 commit 9ee5683
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 8 deletions.
12 changes: 12 additions & 0 deletions app/assets/images/iiif-drag-n-drop.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions app/controllers/mirador_controller.rb
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
##
# Mirador controller providing an iframeable Mirador
class MiradorController < ApplicationController
before_action :set_manifest_url
layout :false
before_action :set_manifest
layout false

def index; end

private

def set_manifest_url
@manifest_url = mirador_params
def set_manifest
@manifest = mirador_params
end

def mirador_params
params.require(:manifest_url)
params.require(:manifest)
end
end
8 changes: 8 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,12 @@ def document_collection_title(value:, **)
def document_leaflet_map(document:, **)
render_document_partial(document, 'show_leaflet_map_wrapper')
end

##
# @param [String] manifest
def iiif_drag_n_drop(manifest)
link_to mirador_index_path(manifest: manifest), class: 'iiif-dnd pull-right', data: { turbolinks: false } do
image_tag 'iiif-drag-n-drop.svg', width: '40px', alt: 'IIIF Drag-n-drop'
end
end
end
4 changes: 2 additions & 2 deletions app/views/mirador/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"saveSession": false,
"data": [
{
"manifestUri": @manifest_url, "location": "Stanford University"
"manifestUri": @manifest, "location": "Stanford University"
}
],
"sidePanelOptions": {
Expand All @@ -20,7 +20,7 @@
},
"windowObjects": [
{
"loadedManifest": @manifest_url,
"loadedManifest": @manifest,
"displayLayout": false,
"bottomPanelVisible": false,
"annotationCreation": false,
Expand Down
4 changes: 3 additions & 1 deletion app/views/viewers/_mirador.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<% if exhibit_specific_manifest %>
<iframe
src="<%= mirador_index_path(
manifest_url: exhibit_specific_manifest
manifest: exhibit_specific_manifest
) %>"
allowfullscreen="true"
class="mirador-embed-wrapper"
Expand All @@ -13,4 +13,6 @@
scrolling="no"
width="100%"
></iframe>

<%= iiif_drag_n_drop(exhibit_specific_manifest) %>
<% end %>
4 changes: 4 additions & 0 deletions spec/views/viewers/_mirador.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@
expect(rendered).to include CGI.escape('https://example.com/abc123')
end
end
it 'has the IIIF drag and drop' do
expect(rendered).to have_css 'a[href="/mirador?manifest=https%3A%2F%2Fpurl'\
'.stanford.edu%2Fbc853rd3116%3Fmanifest"]'
end
end

0 comments on commit 9ee5683

Please sign in to comment.