geoblacklight 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/app/assets/javascripts/geoblacklight/modules/collapse.js +1 -0
- data/app/assets/javascripts/geoblacklight/viewers/map.js +1 -1
- data/app/assets/stylesheets/geoblacklight/_geoblacklight.scss +1 -0
- data/app/assets/stylesheets/geoblacklight/modules/icon-customization.scss +4 -0
- data/app/assets/stylesheets/geoblacklight/modules/results.scss +10 -0
- data/app/assets/stylesheets/geoblacklight/modules/toolbar.scss +5 -0
- data/app/assets/stylesheets/geoblacklight/modules/web_services.scss +5 -0
- data/app/helpers/geoblacklight_helper.rb +8 -0
- data/app/views/catalog/_index_split_default.html.erb +2 -1
- data/app/views/catalog/_show_default_viewer_container.html.erb +1 -1
- data/app/views/catalog/_web_services.html.erb +12 -0
- data/app/views/catalog/web_services.html +1 -0
- data/app/views/catalog/web_services.js.erb +7 -0
- data/config/locales/geoblacklight.en.yml +3 -0
- data/geoblacklight.gemspec +2 -2
- data/lib/generators/geoblacklight/install_generator.rb +1 -13
- data/lib/generators/geoblacklight/templates/catalog_controller.rb +3 -0
- data/lib/generators/geoblacklight/templates/geoblacklight.js +1 -1
- data/lib/generators/geoblacklight/templates/settings.yml +8 -0
- data/lib/geoblacklight.rb +3 -0
- data/lib/geoblacklight/controller_override.rb +7 -3
- data/lib/geoblacklight/download/kmz_download.rb +1 -1
- data/lib/geoblacklight/engine.rb +0 -1
- data/lib/geoblacklight/routes.rb +18 -0
- data/lib/geoblacklight/solr_document.rb +3 -0
- data/lib/geoblacklight/version.rb +1 -1
- data/lib/geoblacklight/view_helper_override.rb +1 -1
- data/spec/controllers/catalog_controller_spec.rb +11 -0
- data/spec/features/web_services_modal_spec.rb +24 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- data/vendor/assets/javascripts/leaflet-iiif.js +185 -0
- data/vendor/assets/javascripts/readmore.min.js +11 -0
- metadata +19 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7a3ffb556c402cb467f68a38e22eedbd9a1c6728
|
4
|
+
data.tar.gz: a3b02401bcf09588a304b1cfd0b6cec5b4d22bdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ab6305640e1412878865612ace63b887cd193532ec4433cba44bd93728161c66735326dd9c549c835bed1d03d6d63b89250b0f98ecc855dc2e0a1d0c3c3f30f
|
7
|
+
data.tar.gz: e38ecfeabde0a079ca7073ef109ddbae2463e4b8e590a9662d7f0367e9f54e4ea52e6c2016a95070b16553d04f63fc169858aa3d78fb574581062acbbce34bfe
|
data/Rakefile
CHANGED
@@ -5,7 +5,7 @@ rescue LoadError
|
|
5
5
|
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
6
|
end
|
7
7
|
|
8
|
-
BLACKLIGHT_JETTY_VERSION = '4.10.
|
8
|
+
BLACKLIGHT_JETTY_VERSION = '4.10.3'
|
9
9
|
ZIP_URL = "https://github.com/projectblacklight/blacklight-jetty/archive/v#{BLACKLIGHT_JETTY_VERSION}.zip"
|
10
10
|
APP_ROOT = File.dirname(__FILE__)
|
11
11
|
|
@@ -55,6 +55,14 @@ module GeoblacklightHelper
|
|
55
55
|
t "geoblacklight.formats.#{format.downcase}"
|
56
56
|
end
|
57
57
|
|
58
|
+
##
|
59
|
+
# Looks up formatted names for references
|
60
|
+
# @param (String, Symbol) reference
|
61
|
+
# @return (String)
|
62
|
+
def formatted_name_reference(reference)
|
63
|
+
t "geoblacklight.references.#{reference}"
|
64
|
+
end
|
65
|
+
|
58
66
|
##
|
59
67
|
# Wraps download text with proper_case_format
|
60
68
|
#
|
@@ -1,11 +1,12 @@
|
|
1
1
|
<% # header bar for doc items in index view -%>
|
2
|
-
<%= content_tag :div, class: 'documentHeader row', data: { layer_id: document[:uuid], bbox: document
|
2
|
+
<%= content_tag :div, class: 'documentHeader row', data: { layer_id: document[:uuid], bbox: document.bounding_box_as_wsen } do %>
|
3
3
|
<div class='status-icons'>
|
4
4
|
<%= geoblacklight_icon(document['layer_geom_type_s']) %>
|
5
5
|
<%= geoblacklight_icon(document['dct_provenance_s']) %>
|
6
6
|
<%= geoblacklight_icon(document['dc_rights_s']) %>
|
7
7
|
</div>
|
8
8
|
<h5 class="index_title col-sm-9s cosl-lg-10 text-span">
|
9
|
+
<span class='caret-toggle'></span>
|
9
10
|
<% counter = document_counter_with_offset(document_counter) %>
|
10
11
|
<span class="document-counter">
|
11
12
|
<%= t('blacklight.search.documents.counter', :counter => counter) if counter %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<% document ||= @document %>
|
2
2
|
<div id='viewer-container' class="col-md-8">
|
3
|
-
<%= content_tag :div, id: 'map', data: { map: 'item', protocol: document.viewer_protocol, url: document.viewer_endpoint, 'layer-id' => document[:layer_id_s], 'map-bbox' => document
|
3
|
+
<%= content_tag :div, id: 'map', data: { map: 'item', protocol: document.viewer_protocol, url: document.viewer_endpoint, 'layer-id' => document[:layer_id_s], 'map-bbox' => document.bounding_box_as_wsen, 'catalog-path'=> catalog_index_path, available: document_available? } do %>
|
4
4
|
<% end %>
|
5
5
|
</div>
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<% document ||= @document %>
|
2
|
+
|
3
|
+
<% document.references.refs.each do |reference| %>
|
4
|
+
<% if Settings.WEBSERVICES_SHOWN.include? reference.type.to_s %>
|
5
|
+
<div class='form-group web-services-form'>
|
6
|
+
<label for='<%= reference.type%>_webservice'>
|
7
|
+
<%= "#{formatted_name_reference(reference.type)} link" %>
|
8
|
+
</label>
|
9
|
+
<input type='text' id='<%= reference.type%>_webservice' value='<%= reference.endpoint %>' readonly='readonly' class='form-control'>
|
10
|
+
</div>
|
11
|
+
<% end %>
|
12
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= render :partial => 'web_services' %>
|
data/geoblacklight.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_dependency 'blacklight', '~> 5.
|
21
|
+
spec.add_dependency 'blacklight', '~> 5.9'
|
22
22
|
spec.add_dependency 'leaflet-rails', '~> 0.7.3'
|
23
23
|
spec.add_dependency 'blacklight_range_limit', '~> 5.0.3'
|
24
24
|
spec.add_dependency 'font-awesome-rails', '~> 4.1.0.0'
|
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
|
|
28
28
|
spec.add_development_dependency 'bundler', '~> 1.5'
|
29
29
|
spec.add_development_dependency 'rake', '~> 10.3.2'
|
30
30
|
spec.add_development_dependency 'rspec-rails', '~> 3.0.1'
|
31
|
-
spec.add_development_dependency 'jettywrapper', '
|
31
|
+
spec.add_development_dependency 'jettywrapper', '>= 2.0'
|
32
32
|
spec.add_development_dependency 'engine_cart', '~> 0.4.0'
|
33
33
|
spec.add_development_dependency 'capybara', '~> 2.3.0'
|
34
34
|
spec.add_development_dependency 'poltergeist', '~> 1.5.0'
|
@@ -9,17 +9,12 @@ module Geoblacklight
|
|
9
9
|
|
10
10
|
desc "Install Geoblacklight"
|
11
11
|
|
12
|
-
def install_rails_assets_gems
|
13
|
-
gem 'rails-assets-leaflet-iiif', '~> 0.0.3', source: 'https://rails-assets.org'
|
14
|
-
gem 'rails-assets-readmore', source: 'https://rails-assets.org'
|
15
|
-
end
|
16
|
-
|
17
12
|
def install_jettywrapper
|
18
13
|
return unless options[:jettywrapper]
|
19
14
|
copy_file 'config/jetty.yml'
|
20
15
|
|
21
16
|
append_to_file 'Rakefile',
|
22
|
-
"\nZIP_URL = \"https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.
|
17
|
+
"\nZIP_URL = \"https://github.com/projectblacklight/blacklight-jetty/archive/v4.10.3.zip\"\n" +
|
23
18
|
"require 'jettywrapper'\n"
|
24
19
|
end
|
25
20
|
|
@@ -49,13 +44,6 @@ module Geoblacklight
|
|
49
44
|
end
|
50
45
|
end
|
51
46
|
|
52
|
-
def inject_routes
|
53
|
-
route 'post "wms/handle"'
|
54
|
-
route 'resources :download, only: [:show, :file]'
|
55
|
-
route "get 'download/file/:id' => 'download#file', as: :download_file"
|
56
|
-
route "get 'download/hgl/:id' => 'download#hgl', as: :download_hgl"
|
57
|
-
end
|
58
|
-
|
59
47
|
def create_downloads_directory
|
60
48
|
FileUtils.mkdir_p("tmp/cache/downloads") unless File.directory?("tmp/cache/downloads")
|
61
49
|
end
|
@@ -205,6 +205,9 @@ class CatalogController < ApplicationController
|
|
205
205
|
# If there are more than this many search results, no spelling ("did you
|
206
206
|
# mean") suggestion is offered.
|
207
207
|
config.spell_max = 5
|
208
|
+
|
209
|
+
# Custom tools for GeoBlacklight
|
210
|
+
config.add_show_tools_partial :web_services, if: proc { |_context, _config, options| (Settings.WEBSERVICES_SHOWN & options[:document].references.refs.map(&:type).map(&:to_s)).any? }
|
208
211
|
end
|
209
212
|
|
210
213
|
|
@@ -1,3 +1,6 @@
|
|
1
|
+
#Main Solr geometry field used for spatial search and bounding box. Should be type 'rpt'
|
2
|
+
GEOMETRY_FIELD: 'solr_bbox'
|
3
|
+
|
1
4
|
# Institution deployed at
|
2
5
|
INSTITUTION: 'Stanford'
|
3
6
|
|
@@ -7,6 +10,11 @@ TIMEOUT_DOWNLOAD: 16
|
|
7
10
|
# (For WMS inspection) timeout and open_timeout parameters for Faraday
|
8
11
|
TIMEOUT_WMS: 4
|
9
12
|
|
13
|
+
# Web services shown in tool panel
|
14
|
+
WEBSERVICES_SHOWN:
|
15
|
+
- 'wms'
|
16
|
+
- 'wfs'
|
17
|
+
|
10
18
|
# WMS Parameters
|
11
19
|
WMS_PARAMS:
|
12
20
|
:SERVICE: 'WMS'
|
data/lib/geoblacklight.rb
CHANGED
@@ -19,6 +19,8 @@ module Geoblacklight
|
|
19
19
|
require 'geoblacklight/download/hgl_download'
|
20
20
|
require 'geoblacklight/reference'
|
21
21
|
require 'geoblacklight/references'
|
22
|
+
require 'geoblacklight/routes'
|
23
|
+
|
22
24
|
def self.inject!
|
23
25
|
CatalogController.send(:include, Geoblacklight::ControllerOverride)
|
24
26
|
CatalogController.send(:include, Geoblacklight::CatalogHelperOverride)
|
@@ -29,6 +31,7 @@ module Geoblacklight
|
|
29
31
|
SearchHistoryController.helpers.is_a?(Geoblacklight::ViewHelperOverride)
|
30
32
|
SavedSearchesController.send(:helper, Geoblacklight::ViewHelperOverride) unless
|
31
33
|
SavedSearchesController.helpers.is_a?(Geoblacklight::ViewHelperOverride)
|
34
|
+
Blacklight::Routes.send(:include, Geoblacklight::Routes)
|
32
35
|
end
|
33
36
|
|
34
37
|
def self.logger
|
@@ -4,15 +4,19 @@ module Geoblacklight
|
|
4
4
|
included do
|
5
5
|
solr_search_params_logic << :add_spatial_params
|
6
6
|
end
|
7
|
-
|
7
|
+
|
8
8
|
def add_spatial_params(solr_params, req_params)
|
9
9
|
if req_params[:bbox]
|
10
10
|
solr_params[:bq] ||= []
|
11
|
-
solr_params[:bq] = ["
|
11
|
+
solr_params[:bq] = ["#{Settings.GEOMETRY_FIELD}:\"IsWithin(#{req_params[:bbox]})\"^10"]
|
12
12
|
solr_params[:fq] ||= []
|
13
|
-
solr_params[:fq] << "
|
13
|
+
solr_params[:fq] << "#{Settings.GEOMETRY_FIELD}:\"Intersects(#{req_params[:bbox]})\""
|
14
14
|
end
|
15
15
|
solr_params
|
16
16
|
end
|
17
|
+
|
18
|
+
def web_services
|
19
|
+
@response, @document = get_solr_response_for_doc_id params[:id]
|
20
|
+
end
|
17
21
|
end
|
18
22
|
end
|
@@ -2,7 +2,7 @@ class KmzDownload < Download
|
|
2
2
|
KMZ_DOWNLOAD_PARAMS = { service: 'wms', version: '1.1.0', request: 'GetMap', srsName: 'EPSG:900913', format: 'application/vnd.google-earth.kmz', width: 2000, height: 2000 }
|
3
3
|
|
4
4
|
def initialize(document)
|
5
|
-
request_params = KMZ_DOWNLOAD_PARAMS.merge(layers: document[:layer_id_s], bbox: document
|
5
|
+
request_params = KMZ_DOWNLOAD_PARAMS.merge(layers: document[:layer_id_s], bbox: document.bounding_box_as_wsen.split(' ').join(', '))
|
6
6
|
super(document, {
|
7
7
|
type: 'kmz',
|
8
8
|
extension: 'kmz',
|
data/lib/geoblacklight/engine.rb
CHANGED
@@ -11,7 +11,6 @@ module Geoblacklight
|
|
11
11
|
|
12
12
|
Blacklight::Configuration.default_values[:view].split.partials = ['index']
|
13
13
|
Blacklight::Configuration.default_values[:view].delete_field('list')
|
14
|
-
|
15
14
|
# GeoblacklightHelper is needed by all helpers, so we inject it
|
16
15
|
# into action view base here.
|
17
16
|
initializer 'geoblacklight.helpers' do |app|
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Geoblacklight
|
2
|
+
module Routes
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
included do |klass|
|
5
|
+
klass.default_route_sets += [:web_services_routes]
|
6
|
+
end
|
7
|
+
|
8
|
+
def web_services_routes(primary_resource)
|
9
|
+
add_routes do |options|
|
10
|
+
post 'wms/handle'
|
11
|
+
resources :download, only: [:show, :file]
|
12
|
+
get 'download/file/:id' => 'download#file', as: :download_file
|
13
|
+
get 'download/hgl/:id' => 'download#hgl', as: :download_hgl
|
14
|
+
get "#{primary_resource}/:id/web_services" => "#{primary_resource}#web_services", as: "web_services_#{primary_resource}"
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -51,6 +51,9 @@ module Geoblacklight
|
|
51
51
|
"http://schema.org/Dataset"
|
52
52
|
end
|
53
53
|
|
54
|
+
def bounding_box_as_wsen
|
55
|
+
get(Settings.GEOMETRY_FIELD.to_sym)
|
56
|
+
end
|
54
57
|
##
|
55
58
|
# Provides a convenience method to access a SolrDocument's References
|
56
59
|
# endpoint url without having to check and see if it is available
|
@@ -30,7 +30,7 @@ module Geoblacklight
|
|
30
30
|
if params[:bbox]
|
31
31
|
content << render_constraint_element('Bounding Box',
|
32
32
|
params[:bbox],
|
33
|
-
remove:
|
33
|
+
remove: search_action_path(remove_spatial_filter_group(:bbox, params)))
|
34
34
|
end
|
35
35
|
|
36
36
|
return content
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe CatalogController, type: :controller do
|
4
|
+
describe '#web_services' do
|
5
|
+
it 'should return a document based off an id' do
|
6
|
+
get :web_services, id: 'mit-us-ma-e25zcta5dct-2000'
|
7
|
+
expect(response.status).to eq 200
|
8
|
+
expect(assigns(:document)).to_not be_nil
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
feature 'web services tools' do
|
4
|
+
feature 'when wms/wfs are provided', js: true do
|
5
|
+
scenario 'shows up in tools' do
|
6
|
+
visit catalog_path 'stanford-cg357zz0321'
|
7
|
+
expect(page).to have_css 'li.web_services a', text: 'Web services'
|
8
|
+
click_link 'Web services'
|
9
|
+
within '.modal-body' do
|
10
|
+
expect(page).to have_css 'input', count: 2
|
11
|
+
expect(page).to have_css 'label', text: 'Web Feature Service (WFS) link'
|
12
|
+
expect(page).to have_css 'input[value="http://geowebservices-restricted.stanford.edu/geoserver/wfs"]'
|
13
|
+
expect(page).to have_css 'label', text: 'Web Mapping Service (WMS) link'
|
14
|
+
expect(page).to have_css 'input[value="http://geowebservices-restricted.stanford.edu/geoserver/wms"]'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
feature 'no wms or wfs provided' do
|
19
|
+
scenario 'does not show up in tools' do
|
20
|
+
visit catalog_path 'mit-001145244'
|
21
|
+
expect(page).to_not have_css 'li.web_services a', text: 'Web services'
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,185 @@
|
|
1
|
+
/*
|
2
|
+
* Leaflet-IIIF 0.0.5
|
3
|
+
* IIIF Viewer for Leaflet
|
4
|
+
* by Jack Reed, @mejackreed
|
5
|
+
*/
|
6
|
+
|
7
|
+
L.TileLayer.Iiif = L.TileLayer.extend({
|
8
|
+
options: {
|
9
|
+
continuousWorld: true,
|
10
|
+
tileSize: 256,
|
11
|
+
updateWhenIdle: true
|
12
|
+
},
|
13
|
+
|
14
|
+
initialize: function(url, options) {
|
15
|
+
options = L.setOptions(this, options);
|
16
|
+
this._infoDeferred = new $.Deferred();
|
17
|
+
this._infoUrl = url;
|
18
|
+
this._baseUrl = this._templateUrl();
|
19
|
+
this._getInfo();
|
20
|
+
},
|
21
|
+
getTileUrl: function(coords) {
|
22
|
+
var _this = this,
|
23
|
+
x = coords.x,
|
24
|
+
y = (coords.y),
|
25
|
+
zoom = _this._map.getZoom(),
|
26
|
+
scale = Math.pow(2, _this.maxZoom - zoom),
|
27
|
+
tileBaseSize = _this.options.tileSize * scale,
|
28
|
+
minx = (x * tileBaseSize),
|
29
|
+
miny = (y * tileBaseSize),
|
30
|
+
maxx = Math.min(minx + tileBaseSize, _this.x),
|
31
|
+
maxy = Math.min(miny + tileBaseSize, _this.y);
|
32
|
+
|
33
|
+
return L.Util.template(this._baseUrl, L.extend({
|
34
|
+
format: 'jpg',
|
35
|
+
quality: _this.quality,
|
36
|
+
region: [minx, miny, (maxx - minx), (maxy - miny)].join(','),
|
37
|
+
rotation: 0,
|
38
|
+
size: 'pct:' + (100 / scale)
|
39
|
+
}, this.options));
|
40
|
+
},
|
41
|
+
onAdd: function(map) {
|
42
|
+
var _this = this;
|
43
|
+
|
44
|
+
// Wait for deferred to complete
|
45
|
+
$.when(_this._infoDeferred).done(function() {
|
46
|
+
|
47
|
+
// Find best zoom level and center map
|
48
|
+
var initialZoom = _this._getInitialZoom(map.getSize()),
|
49
|
+
imageSize = _this._imageSizes[initialZoom],
|
50
|
+
sw = map.options.crs.pointToLatLng(L.point(0, imageSize.y), initialZoom),
|
51
|
+
ne = map.options.crs.pointToLatLng(L.point(imageSize.x, 0), initialZoom),
|
52
|
+
bounds = L.latLngBounds(sw, ne);
|
53
|
+
|
54
|
+
map.fitBounds(bounds, true);
|
55
|
+
|
56
|
+
// Set maxZoom for map
|
57
|
+
map._layersMaxZoom = _this.maxZoom;
|
58
|
+
|
59
|
+
// Call add TileLayer
|
60
|
+
L.TileLayer.prototype.onAdd.call(_this, map);
|
61
|
+
|
62
|
+
// Reset tile sizes to handle non 256x256 IIIF tiles
|
63
|
+
_this.on('tileload', function(tile, url) {
|
64
|
+
|
65
|
+
var height = tile.tile.naturalHeight,
|
66
|
+
width = tile.tile.naturalWidth;
|
67
|
+
|
68
|
+
// No need to resize if tile is 256 x 256
|
69
|
+
if (height === 256 && width === 256) return;
|
70
|
+
|
71
|
+
tile.tile.style.width = width + 'px';
|
72
|
+
tile.tile.style.height = height + 'px';
|
73
|
+
|
74
|
+
});
|
75
|
+
});
|
76
|
+
},
|
77
|
+
_getInfo: function() {
|
78
|
+
var _this = this;
|
79
|
+
|
80
|
+
// Look for a way to do this without jQuery
|
81
|
+
$.getJSON(_this._infoUrl)
|
82
|
+
.done(function(data) {
|
83
|
+
_this.y = data.height;
|
84
|
+
_this.x = data.width;
|
85
|
+
|
86
|
+
var profile,
|
87
|
+
tierSizes = [],
|
88
|
+
imageSizes = [],
|
89
|
+
scale,
|
90
|
+
width_,
|
91
|
+
height_,
|
92
|
+
tilesX_,
|
93
|
+
tilesY_;
|
94
|
+
|
95
|
+
// Set quality based off of IIIF version
|
96
|
+
if (data.profile instanceof Array) {
|
97
|
+
profile = data.profile[0];
|
98
|
+
}else {
|
99
|
+
profile = data.profile;
|
100
|
+
}
|
101
|
+
switch (profile) {
|
102
|
+
case 'http://library.stanford.edu/iiif/image-api/compliance.html#level1':
|
103
|
+
_this.quality = 100;
|
104
|
+
break;
|
105
|
+
case 'http://library.stanford.edu/iiif/image-api/1.1/compliance.html':
|
106
|
+
_this.quality = 'native';
|
107
|
+
break;
|
108
|
+
case 'http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1':
|
109
|
+
_this.quality = 'native';
|
110
|
+
break;
|
111
|
+
case 'http://iiif.io/api/image/2/level2.json':
|
112
|
+
_this.quality = 'default';
|
113
|
+
break;
|
114
|
+
case 'http://iiif.io/api/image/2/level1.json':
|
115
|
+
_this.quality = 'default';
|
116
|
+
break;
|
117
|
+
case 'http://iiif.io/api/image/2/level0.json':
|
118
|
+
_this.quality = 'default';
|
119
|
+
break;
|
120
|
+
}
|
121
|
+
|
122
|
+
ceilLog2 = function(x) {
|
123
|
+
return Math.ceil(Math.log(x) / Math.LN2);
|
124
|
+
};
|
125
|
+
|
126
|
+
// Calculates maxZoom for the layer
|
127
|
+
_this.maxZoom = Math.max(ceilLog2(_this.x / _this.options.tileSize),
|
128
|
+
ceilLog2(_this.y / _this.options.tileSize));
|
129
|
+
|
130
|
+
for (var i = 0; i <= _this.maxZoom; i++) {
|
131
|
+
scale = Math.pow(2, _this.maxZoom - i);
|
132
|
+
width_ = Math.ceil(_this.x / scale);
|
133
|
+
height_ = Math.ceil(_this.y / scale);
|
134
|
+
tilesX_ = Math.ceil(width_ / _this.options.tileSize);
|
135
|
+
tilesY_ = Math.ceil(height_ / _this.options.tileSize);
|
136
|
+
tierSizes.push([tilesX_, tilesY_]);
|
137
|
+
imageSizes.push(L.point(width_,height_));
|
138
|
+
}
|
139
|
+
|
140
|
+
_this._tierSizes = tierSizes;
|
141
|
+
_this._imageSizes = imageSizes;
|
142
|
+
|
143
|
+
// Resolved Deferred to initiate tilelayer load
|
144
|
+
_this._infoDeferred.resolve();
|
145
|
+
});
|
146
|
+
},
|
147
|
+
_infoToBaseUrl: function() {
|
148
|
+
return this._infoUrl.replace('info.json', '');
|
149
|
+
},
|
150
|
+
_templateUrl: function() {
|
151
|
+
return this._infoToBaseUrl() + '{region}/{size}/{rotation}/{quality}.{format}';
|
152
|
+
},
|
153
|
+
_tileShouldBeLoaded: function(coords) {
|
154
|
+
var _this = this,
|
155
|
+
zoom = _this._map.getZoom(),
|
156
|
+
sizes = _this._tierSizes[zoom],
|
157
|
+
x = coords.x,
|
158
|
+
y = (coords.y);
|
159
|
+
|
160
|
+
if (!sizes) return false;
|
161
|
+
if (x < 0 || sizes[0] <= x || y < 0 || sizes[1] <= y) {
|
162
|
+
return false;
|
163
|
+
}else {
|
164
|
+
return true;
|
165
|
+
}
|
166
|
+
},
|
167
|
+
_getInitialZoom: function (mapSize) {
|
168
|
+
var _this = this,
|
169
|
+
tolerance = 0.8,
|
170
|
+
imageSize;
|
171
|
+
|
172
|
+
for (var i = _this.maxZoom; i >= 0; i--) {
|
173
|
+
imageSize = this._imageSizes[i];
|
174
|
+
if (imageSize.x * tolerance < mapSize.x && imageSize.y * tolerance < mapSize.y) {
|
175
|
+
return i;
|
176
|
+
}
|
177
|
+
}
|
178
|
+
// return a default zoom
|
179
|
+
return 2;
|
180
|
+
}
|
181
|
+
});
|
182
|
+
|
183
|
+
L.tileLayer.iiif = function(url, options) {
|
184
|
+
return new L.TileLayer.Iiif(url, options);
|
185
|
+
};
|
@@ -0,0 +1,11 @@
|
|
1
|
+
/*!
|
2
|
+
* @preserve
|
3
|
+
*
|
4
|
+
* Readmore.js jQuery plugin
|
5
|
+
* Author: @jed_foster
|
6
|
+
* Project home: http://jedfoster.github.io/Readmore.js
|
7
|
+
* Licensed under the MIT license
|
8
|
+
*
|
9
|
+
* Debounce function from http://davidwalsh.name/javascript-debounce-function
|
10
|
+
*/
|
11
|
+
!function(e){"use strict";function t(e,t,a){var i;return function(){var n=this,o=arguments,r=function(){i=null,a||e.apply(n,o)},s=a&&!i;clearTimeout(i),i=setTimeout(r,t),s&&e.apply(n,o)}}function a(e){var t=++h;return String(null==e?"rmjs-":e)+t}function i(e){var t=e.clone().css({height:"auto",width:e.width(),maxHeight:"none",overflow:"hidden"}).insertAfter(e),a=t.outerHeight(),i=parseInt(t.css({maxHeight:""}).css("max-height").replace(/[^-\d\.]/g,""),10),n=e.data("defaultHeight");t.remove();var o=i||e.data("collapsedHeight")||n;e.data({expandedHeight:a,maxHeight:i,collapsedHeight:o}).css({maxHeight:"none"})}function n(e){if(!d[e.selector]){var t=" ";e.embedCSS&&""!==e.blockCSS&&(t+=e.selector+" + [data-readmore-toggle], "+e.selector+"[data-readmore]{"+e.blockCSS+"}"),t+=e.selector+"[data-readmore]{transition: height "+e.speed+"ms;overflow: hidden;}",function(e,t){var a=e.createElement("style");a.type="text/css",a.styleSheet?a.styleSheet.cssText=t:a.appendChild(e.createTextNode(t)),e.getElementsByTagName("head")[0].appendChild(a)}(document,t),d[e.selector]=!0}}function o(t,a){this.element=t,this.options=e.extend({},s,a),n(this.options),this._defaults=s,this._name=r,this.init(),window.addEventListener("load",l),window.addEventListener("resize",l)}var r="readmore",s={speed:100,collapsedHeight:200,heightMargin:16,moreLink:'<a href="#">Read More</a>',lessLink:'<a href="#">Close</a>',embedCSS:!0,blockCSS:"display: block; width: 100%;",startOpen:!1,beforeToggle:function(){},afterToggle:function(){}},d={},h=0,l=t(function(){e("[data-readmore]").each(function(){var t=e(this),a="true"===t.attr("aria-expanded");i(t),t.css({height:t.data(a?"expandedHeight":"collapsedHeight")})})},100);o.prototype={init:function(){var t=this,n=e(this.element);n.data({defaultHeight:this.options.collapsedHeight,heightMargin:this.options.heightMargin}),i(n);var o=n.data("collapsedHeight"),r=n.data("heightMargin");if(n.outerHeight(!0)<=o+r)return!0;var s=n.attr("id")||a(),d=t.options.startOpen?t.options.lessLink:t.options.moreLink;n.attr({"data-readmore":"","aria-expanded":!1,id:s}),n.after(e(d).on("click",function(e){t.toggle(this,n[0],e)}).attr({"data-readmore-toggle":"","aria-controls":s})),t.options.startOpen||n.css({height:o})},toggle:function(t,a,i){i&&i.preventDefault(),t||(t=e('[aria-controls="'+this.element.id+'"]')[0]),a||(a=this.element);var n=this,o=e(a),r="",s="",d=!1,h=o.data("collapsedHeight");o.height()<=h?(r=o.data("expandedHeight")+"px",s="lessLink",d=!0):(r=h,s="moreLink"),n.options.beforeToggle(t,a,!d),o.css({height:r}),o.on("transitionend",function(){n.options.afterToggle(t,a,d),e(this).attr({"aria-expanded":d}).off("transitionend")}),e(t).replaceWith(e(n.options[s]).on("click",function(e){n.toggle(this,a,e)}).attr({"data-readmore-toggle":"","aria-controls":o.attr("id")}))},destroy:function(){e(this.element).each(function(){var t=e(this);t.attr({"data-readmore":null,"aria-expanded":null}).css({maxHeight:"",height:""}).next("[data-readmore-toggle]").remove(),t.removeData()})}},e.fn.readmore=function(t){var a=arguments,i=this.selector;return t=t||{},"object"==typeof t?this.each(function(){if(e.data(this,"plugin_"+r)){var a=e.data(this,"plugin_"+r);a.destroy.apply(a)}t.selector=i,e.data(this,"plugin_"+r,new o(this,t))}):"string"==typeof t&&"_"!==t[0]&&"init"!==t?this.each(function(){var i=e.data(this,"plugin_"+r);i instanceof o&&"function"==typeof i[t]&&i[t].apply(i,Array.prototype.slice.call(a,1))}):void 0}}(jQuery);
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geoblacklight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Graves
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2015-02-
|
14
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: blacklight
|
@@ -19,14 +19,14 @@ dependencies:
|
|
19
19
|
requirements:
|
20
20
|
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 5.
|
22
|
+
version: '5.9'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 5.
|
29
|
+
version: '5.9'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: leaflet-rails
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,16 +143,16 @@ dependencies:
|
|
143
143
|
name: jettywrapper
|
144
144
|
requirement: !ruby/object:Gem::Requirement
|
145
145
|
requirements:
|
146
|
-
- - "
|
146
|
+
- - ">="
|
147
147
|
- !ruby/object:Gem::Version
|
148
|
-
version:
|
148
|
+
version: '2.0'
|
149
149
|
type: :development
|
150
150
|
prerelease: false
|
151
151
|
version_requirements: !ruby/object:Gem::Requirement
|
152
152
|
requirements:
|
153
|
-
- - "
|
153
|
+
- - ">="
|
154
154
|
- !ruby/object:Gem::Version
|
155
|
-
version:
|
155
|
+
version: '2.0'
|
156
156
|
- !ruby/object:Gem::Dependency
|
157
157
|
name: engine_cart
|
158
158
|
requirement: !ruby/object:Gem::Requirement
|
@@ -279,6 +279,7 @@ files:
|
|
279
279
|
- app/assets/stylesheets/geoblacklight/modules/results.scss
|
280
280
|
- app/assets/stylesheets/geoblacklight/modules/search_widgets.scss
|
281
281
|
- app/assets/stylesheets/geoblacklight/modules/toolbar.scss
|
282
|
+
- app/assets/stylesheets/geoblacklight/modules/web_services.scss
|
282
283
|
- app/controllers/download_controller.rb
|
283
284
|
- app/controllers/wms_controller.rb
|
284
285
|
- app/helpers/geoblacklight_helper.rb
|
@@ -296,7 +297,10 @@ files:
|
|
296
297
|
- app/views/catalog/_show_header_default.html.erb
|
297
298
|
- app/views/catalog/_show_tools.html.erb
|
298
299
|
- app/views/catalog/_upper_metadata.html.erb
|
300
|
+
- app/views/catalog/_web_services.html.erb
|
299
301
|
- app/views/catalog/index.html.erb
|
302
|
+
- app/views/catalog/web_services.html
|
303
|
+
- app/views/catalog/web_services.js.erb
|
300
304
|
- app/views/download/hgl.html.erb
|
301
305
|
- app/views/shared/_header_navbar.html.erb
|
302
306
|
- config/initializers/rails_config.rb
|
@@ -325,12 +329,14 @@ files:
|
|
325
329
|
- lib/geoblacklight/item_viewer.rb
|
326
330
|
- lib/geoblacklight/reference.rb
|
327
331
|
- lib/geoblacklight/references.rb
|
332
|
+
- lib/geoblacklight/routes.rb
|
328
333
|
- lib/geoblacklight/solr_document.rb
|
329
334
|
- lib/geoblacklight/version.rb
|
330
335
|
- lib/geoblacklight/view_helper_override.rb
|
331
336
|
- lib/geoblacklight/wms_layer.rb
|
332
337
|
- lib/geoblacklight/wms_layer/feature_info_response.rb
|
333
338
|
- lib/tasks/geoblacklight.rake
|
339
|
+
- spec/controllers/catalog_controller_spec.rb
|
334
340
|
- spec/controllers/download_controller_spec.rb
|
335
341
|
- spec/factories/user.rb
|
336
342
|
- spec/features/download_layer_spec.rb
|
@@ -343,6 +349,7 @@ files:
|
|
343
349
|
- spec/features/search_bar_spec.rb
|
344
350
|
- spec/features/show_page_metadata_spec.rb
|
345
351
|
- spec/features/split_view.html.erb_spec.rb
|
352
|
+
- spec/features/web_services_modal_spec.rb
|
346
353
|
- spec/fixtures/solr_documents/actual-papermap1.json
|
347
354
|
- spec/fixtures/solr_documents/actual-point1.json
|
348
355
|
- spec/fixtures/solr_documents/actual-polygon1.json
|
@@ -372,7 +379,9 @@ files:
|
|
372
379
|
- spec/views/catalog/_document_split.html.erb_spec.rb
|
373
380
|
- spec/views/catalog/_index_split.html.erb_spec.rb
|
374
381
|
- template.rb
|
382
|
+
- vendor/assets/javascripts/leaflet-iiif.js
|
375
383
|
- vendor/assets/javascripts/native.history.js
|
384
|
+
- vendor/assets/javascripts/readmore.min.js
|
376
385
|
homepage: http://github.com/geoblacklight/geoblacklight
|
377
386
|
licenses:
|
378
387
|
- Apache 2.0
|
@@ -398,6 +407,7 @@ signing_key:
|
|
398
407
|
specification_version: 4
|
399
408
|
summary: A discovery platform for geospatial holdings
|
400
409
|
test_files:
|
410
|
+
- spec/controllers/catalog_controller_spec.rb
|
401
411
|
- spec/controllers/download_controller_spec.rb
|
402
412
|
- spec/factories/user.rb
|
403
413
|
- spec/features/download_layer_spec.rb
|
@@ -410,6 +420,7 @@ test_files:
|
|
410
420
|
- spec/features/search_bar_spec.rb
|
411
421
|
- spec/features/show_page_metadata_spec.rb
|
412
422
|
- spec/features/split_view.html.erb_spec.rb
|
423
|
+
- spec/features/web_services_modal_spec.rb
|
413
424
|
- spec/fixtures/solr_documents/actual-papermap1.json
|
414
425
|
- spec/fixtures/solr_documents/actual-point1.json
|
415
426
|
- spec/fixtures/solr_documents/actual-polygon1.json
|