-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
slight modifications to iiif-viewer pull request
- Loading branch information
1 parent
15e2a3e
commit fbaa06d
Showing
15 changed files
with
149 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,15 @@ | ||
Blacklight.onLoad(function () { | ||
Blacklight.onLoad(function() { | ||
$('[data-map="home"]').each(function(i, element) { | ||
var options = { | ||
/** | ||
* Initial bounds of map | ||
* @type {L.LatLngBounds} | ||
*/ | ||
bbox: [[-85, -180], [85, 180]] | ||
}; | ||
|
||
var geoblacklight = new GeoBlacklight.Viewer.Leaflet(this, options), | ||
var geoblacklight = new GeoBlacklight.Viewer.Leaflet(this), | ||
data = $(this).data(); | ||
geoblacklight.map.addControl(L.control.geosearch({ | ||
baseUrl: data.catalogPath, | ||
dynamic: false, | ||
searcher: function() { | ||
window.location.href = this.getSearchUrl(); | ||
window.location.href = this.getSearchUrl(); | ||
}, | ||
staticButton: '<a class="btn btn-primary">Search Here</a>' | ||
})); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
module Geoblacklight | ||
class ItemViewer | ||
def initialize(references) | ||
@references = references | ||
end | ||
|
||
def viewer_protocol | ||
return 'leaflet' if viewer_preference.nil? | ||
viewer_preference.keys.first.to_s | ||
end | ||
|
||
def viewer_endpoint | ||
return '' if viewer_preference.nil? | ||
viewer_preference.values.first.to_s | ||
end | ||
|
||
def wms | ||
@references.wms | ||
end | ||
|
||
def iiif | ||
@references.iiif | ||
end | ||
|
||
def viewer_preference | ||
[wms, iiif].compact.map(&:to_hash).first | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
require 'spec_helper' | ||
|
||
describe Geoblacklight::ItemViewer do | ||
let(:document) { SolrDocument.new(document_attributes) } | ||
let(:document_attributes) { {} } | ||
let(:references) { document.references } | ||
let(:item_viewer) { Geoblacklight::ItemViewer.new(references) } | ||
describe 'viewer_preference' do | ||
describe 'for no references' do | ||
it 'returns nil' do | ||
expect(item_viewer.viewer_preference).to be_nil | ||
end | ||
end | ||
describe 'for wms reference' do | ||
let(:document_attributes) { | ||
{ | ||
dct_references_s: { | ||
'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://www.example.com/wms', | ||
'http://iiif.io/api/image' => 'http://www.example.com/iiif' | ||
}.to_json | ||
} | ||
} | ||
it 'wms if wms is present' do | ||
expect(item_viewer.viewer_preference).to eq wms: 'http://www.example.com/wms' | ||
end | ||
end | ||
describe 'for iiif only reference' do | ||
let(:document_attributes) { | ||
{ | ||
dct_references_s: { | ||
'http://iiif.io/api/image' => 'http://www.example.com/iiif' | ||
}.to_json | ||
} | ||
} | ||
it 'returns iiif' do | ||
expect(item_viewer.viewer_preference).to eq iiif: 'http://www.example.com/iiif' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters