geoblacklight 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/geoblacklight/geoblacklight.js +5 -58
- data/app/assets/javascripts/geoblacklight/modules.js +1 -0
- data/app/assets/javascripts/geoblacklight/modules/home.js +3 -2
- data/app/assets/javascripts/geoblacklight/modules/item.js +10 -73
- data/app/assets/javascripts/geoblacklight/modules/results.js +25 -28
- data/app/assets/javascripts/geoblacklight/viewers.js +1 -0
- data/app/assets/javascripts/geoblacklight/viewers/iiif.js +25 -0
- data/app/assets/javascripts/geoblacklight/viewers/map.js +54 -0
- data/app/assets/javascripts/geoblacklight/viewers/viewer.js +14 -0
- data/app/assets/javascripts/geoblacklight/viewers/wms.js +73 -0
- data/app/assets/stylesheets/geoblacklight/modules/item.css.scss +1 -1
- data/app/helpers/geoblacklight_helper.rb +0 -11
- data/app/views/catalog/_abstract_metadata.html.erb +8 -0
- data/app/views/catalog/_show_default.html.erb +2 -2
- data/app/views/catalog/_show_sidebar.html.erb +8 -6
- data/app/views/catalog/_upper_metadata.html.erb +11 -10
- data/geoblacklight.gemspec +3 -3
- data/lib/generators/geoblacklight/templates/geoblacklight.js +3 -1
- data/lib/geoblacklight.rb +1 -0
- data/lib/geoblacklight/item_viewer.rb +29 -0
- data/lib/geoblacklight/references.rb +2 -0
- data/lib/geoblacklight/solr_document.rb +7 -1
- data/lib/geoblacklight/version.rb +1 -1
- data/spec/features/download_layer_spec.rb +1 -1
- data/spec/lib/geoblacklight/item_viewer_spec.rb +40 -0
- data/spec/lib/geoblacklight/references_spec.rb +26 -0
- data/spec/lib/geoblacklight/solr_document_spec.rb +57 -0
- data/vendor/assets/javascripts/leaflet-iiif.js +152 -0
- data/vendor/assets/javascripts/readmore.min.js +7 -0
- metadata +22 -7
- data/app/assets/javascripts/geoblacklight/application.js +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2569474d1cd7946363ce5ba8be7d783145007c9f
|
4
|
+
data.tar.gz: dfb2e56fe8bc2302698a2192fd7a7bedac2c442d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5093d1b9eda7a53ef3b64c5a22f2bf02bdde068e904234471d4c5a2c68c23c934f743d827ac304ff340a8b46a0a6a759b5b6bffcd440ed1def990b6758b1ec13
|
7
|
+
data.tar.gz: 02d642f50886e7b86dd96999840f58ba91f787f217403f15e79baf4585b15d3788ccf3b79b30f7509a4673e08beed001d32e3f88ef540c2b4ee2e18fb9b6a80d
|
@@ -1,3 +1,8 @@
|
|
1
|
+
//= require leaflet
|
2
|
+
//= require leaflet-iiif
|
3
|
+
//= require native.history
|
4
|
+
//= require readmore.min
|
5
|
+
|
1
6
|
!function(global) {
|
2
7
|
'use strict';
|
3
8
|
|
@@ -16,7 +21,6 @@
|
|
16
21
|
};
|
17
22
|
|
18
23
|
var GeoBlacklight = L.Class.extend({
|
19
|
-
|
20
24
|
statics: {
|
21
25
|
__version__: '0.0.1',
|
22
26
|
|
@@ -30,64 +34,7 @@
|
|
30
34
|
}, delay);
|
31
35
|
};
|
32
36
|
}
|
33
|
-
},
|
34
|
-
|
35
|
-
options: {
|
36
|
-
/**
|
37
|
-
* Initial bounds of map
|
38
|
-
* @type {L.LatLngBounds}
|
39
|
-
*/
|
40
|
-
bbox: [[-85, -180], [85, 180]]
|
41
|
-
},
|
42
|
-
|
43
|
-
initialize: function(el, options) {
|
44
|
-
var data = $(el).data(),
|
45
|
-
basemap, map;
|
46
|
-
|
47
|
-
L.Util.setOptions(this, options);
|
48
|
-
|
49
|
-
basemap = L.tileLayer(
|
50
|
-
'https://otile{s}-s.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
|
51
|
-
attribution: '© <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, Tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="//developer.mapquest.com/content/osm/mq_logo.png">',
|
52
|
-
maxZoom: 18,
|
53
|
-
worldCopyJump: true,
|
54
|
-
subdomains: '1234' // see http://developer.mapquest.com/web/products/open/map
|
55
|
-
}
|
56
|
-
);
|
57
|
-
|
58
|
-
this.overlay = L.layerGroup();
|
59
|
-
|
60
|
-
map = L.map(el);
|
61
|
-
this.map = map;
|
62
|
-
map.addLayer(basemap);
|
63
|
-
map.addLayer(this.overlay);
|
64
|
-
|
65
|
-
map.fitBounds(this.options.bbox);
|
66
|
-
|
67
|
-
},
|
68
|
-
|
69
|
-
/**
|
70
|
-
* Add a bounding box overlay to map.
|
71
|
-
* @param {L.LatLngBounds} bounds Leaflet LatLngBounds
|
72
|
-
*/
|
73
|
-
addBoundsOverlay: function(bounds) {
|
74
|
-
if (bounds instanceof L.LatLngBounds) {
|
75
|
-
this.overlay.addLayer(L.polygon([
|
76
|
-
bounds.getSouthWest(),
|
77
|
-
bounds.getSouthEast(),
|
78
|
-
bounds.getNorthEast(),
|
79
|
-
bounds.getNorthWest()
|
80
|
-
]));
|
81
|
-
}
|
82
|
-
},
|
83
|
-
|
84
|
-
/**
|
85
|
-
* Remove bounding box overlay from map.
|
86
|
-
*/
|
87
|
-
removeBoundsOverlay: function() {
|
88
|
-
this.overlay.clearLayers();
|
89
37
|
}
|
90
|
-
|
91
38
|
});
|
92
39
|
|
93
40
|
global.GeoBlacklight = GeoBlacklight;
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require_tree ./modules
|
@@ -1,6 +1,7 @@
|
|
1
|
-
Blacklight.onLoad(function
|
1
|
+
Blacklight.onLoad(function() {
|
2
2
|
$('[data-map="home"]').each(function(i, element) {
|
3
|
-
|
3
|
+
|
4
|
+
var geoblacklight = new GeoBlacklight.Viewer.Map(this),
|
4
5
|
data = $(this).data();
|
5
6
|
geoblacklight.map.addControl(L.control.geosearch({
|
6
7
|
baseUrl: data.catalogPath,
|
@@ -1,79 +1,16 @@
|
|
1
1
|
Blacklight.onLoad(function() {
|
2
2
|
$('[data-map="item"]').each(function(i, element) {
|
3
|
-
var bbox = L.bboxToBounds($(this).data().mapBbox);
|
4
|
-
new GeoBlacklight.Item(element, { bbox: bbox });
|
5
|
-
});
|
6
|
-
});
|
7
|
-
|
8
|
-
GeoBlacklight.Item = GeoBlacklight.extend({
|
9
|
-
|
10
|
-
initialize: function(element, options) {
|
11
|
-
GeoBlacklight.prototype.initialize.call(this, element, options);
|
12
|
-
this.dataAttributes = $(element).data();
|
13
|
-
this.layer = new L.layerGroup().addTo(this.map);
|
14
|
-
if (this.dataAttributes.available && this.dataAttributes.wmsUrl !== null) {
|
15
|
-
this.addPreviewLayer();
|
16
|
-
this.addOpacityControl();
|
17
|
-
} else {
|
18
|
-
this.addBoundsOverlay(L.bboxToBounds(this.dataAttributes.mapBbox));
|
19
|
-
}
|
20
|
-
},
|
21
3
|
|
22
|
-
|
23
|
-
var
|
24
|
-
|
25
|
-
|
26
|
-
format: 'image/png',
|
27
|
-
transparent: true,
|
28
|
-
tiled: true,
|
29
|
-
CRS: 'EPSG:900913',
|
30
|
-
opacity: 0.75
|
31
|
-
});
|
32
|
-
_this.layer.addLayer(_this.wmsLayer);
|
33
|
-
_this.setupInspection();
|
34
|
-
},
|
4
|
+
// get viewer module from protocol value and capitalize to match class name
|
5
|
+
var viewerName = $(element).data().protocol,
|
6
|
+
viewer;
|
7
|
+
viewerName = viewerName.charAt(0).toUpperCase() + viewerName.substring(1);
|
35
8
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
},
|
40
|
-
|
41
|
-
setupInspection: function() {
|
42
|
-
var _this = this;
|
43
|
-
_this.map.on('click', function(e) {
|
44
|
-
spinner = '<span id="attribute-table"><i class="fa fa-spinner fa-spin fa-3x fa-align-center"></i></span>';
|
45
|
-
$('#attribute-table').replaceWith(spinner);
|
46
|
-
var wmsoptions = {
|
47
|
-
URL: _this.dataAttributes.wmsUrl,
|
48
|
-
LAYERS: _this.dataAttributes.layerId,
|
49
|
-
BBOX: _this.map.getBounds().toBBoxString(),
|
50
|
-
WIDTH: $('#map').width(),
|
51
|
-
HEIGHT: $('#map').height(),
|
52
|
-
QUERY_LAYERS: _this.dataAttributes.layerId,
|
53
|
-
X: Math.round(e.containerPoint.x),
|
54
|
-
Y: Math.round(e.containerPoint.y)
|
55
|
-
};
|
56
|
-
|
57
|
-
$.ajax({
|
58
|
-
type: 'POST',
|
59
|
-
url: '/wms/handle',
|
60
|
-
data: wmsoptions,
|
61
|
-
success: function(data) {
|
62
|
-
if (data.hasOwnProperty('error')) {
|
63
|
-
$('#attribute-table').html('Could not find that feature');
|
64
|
-
return;
|
65
|
-
}
|
66
|
-
var t = $('<table id="attribute-table" class="table table-hover table-condensed table-responsive table-striped table-bordered"><thead><tr><th>Attribute</th><th>Value</th></tr></thead><tbody>');
|
67
|
-
$.each(data.values, function(i,val) {
|
68
|
-
t.append('<tr><td>' + val[0] + '</td><td>' + val[1] + '</tr>');
|
69
|
-
});
|
70
|
-
$('#attribute-table').replaceWith(t);
|
71
|
-
},
|
72
|
-
fail: function(error) {
|
73
|
-
console.log(error);
|
74
|
-
}
|
75
|
-
});
|
76
|
-
});
|
77
|
-
}
|
9
|
+
// get new viewer instance and pass in element
|
10
|
+
viewer = new window['GeoBlacklight']['Viewer'][viewerName](element);
|
11
|
+
});
|
78
12
|
|
13
|
+
$('.truncate-abstract').readmore({
|
14
|
+
maxHeight: 60
|
15
|
+
});
|
79
16
|
});
|
@@ -10,14 +10,14 @@ Blacklight.onLoad(function() {
|
|
10
10
|
|
11
11
|
$('[data-map="index"]').each(function() {
|
12
12
|
var data = $(this).data(),
|
13
|
-
|
14
|
-
|
13
|
+
opts = { baseUrl: data.catalogPath },
|
14
|
+
geoblacklight, bbox;
|
15
15
|
|
16
|
-
if (typeof data.mapBbox ===
|
16
|
+
if (typeof data.mapBbox === 'string') {
|
17
17
|
bbox = L.bboxToBounds(data.mapBbox);
|
18
18
|
} else {
|
19
19
|
$('.document [data-bbox]').each(function() {
|
20
|
-
if (typeof bbox ===
|
20
|
+
if (typeof bbox === 'undefined') {
|
21
21
|
bbox = L.bboxToBounds($(this).data().bbox);
|
22
22
|
} else {
|
23
23
|
bbox.extend(L.bboxToBounds($(this).data().bbox));
|
@@ -34,39 +34,36 @@ Blacklight.onLoad(function() {
|
|
34
34
|
});
|
35
35
|
}
|
36
36
|
|
37
|
-
|
37
|
+
// instantiate new map
|
38
|
+
geoblacklight = new GeoBlacklight.Viewer.Map(this, { bbox: bbox });
|
39
|
+
|
40
|
+
// set hover listeners on map
|
41
|
+
$('#content')
|
42
|
+
.on('mouseenter', '#documents [data-layer-id]', function() {
|
43
|
+
var bounds = L.bboxToBounds($(this).data('bbox'));
|
44
|
+
geoblacklight.addBoundsOverlay(bounds);
|
45
|
+
})
|
46
|
+
.on('mouseleave', '#documents [data-layer-id]', function() {
|
47
|
+
geoblacklight.removeBoundsOverlay();
|
48
|
+
});
|
49
|
+
|
50
|
+
// add geosearch control to map
|
38
51
|
geoblacklight.map.addControl(L.control.geosearch(opts));
|
39
52
|
});
|
40
53
|
|
41
54
|
function updatePage(url) {
|
42
55
|
$.get(url).done(function(data) {
|
43
56
|
var resp = $.parseHTML(data);
|
44
|
-
|
45
|
-
$(
|
46
|
-
$(
|
47
|
-
$(
|
48
|
-
if ($(
|
49
|
-
$(
|
57
|
+
$doc = $(resp);
|
58
|
+
$('#documents').replaceWith($doc.find('#documents'));
|
59
|
+
$('#sidebar').replaceWith($doc.find('#sidebar'));
|
60
|
+
$('#sortAndPerPage').replaceWith($doc.find('#sortAndPerPage'));
|
61
|
+
if ($('#map').next().length) {
|
62
|
+
$('#map').next().replaceWith($doc.find('#map').next());
|
50
63
|
} else {
|
51
|
-
$(
|
64
|
+
$('#map').after($doc.find('#map').next());
|
52
65
|
}
|
53
66
|
});
|
54
67
|
}
|
55
68
|
|
56
69
|
});
|
57
|
-
|
58
|
-
GeoBlacklight.prototype.setHoverListeners = function() {
|
59
|
-
var _this = this;
|
60
|
-
|
61
|
-
$("#content")
|
62
|
-
.on("mouseenter", "#documents [data-layer-id]", function() {
|
63
|
-
var bounds = L.bboxToBounds($(this).data('bbox'));
|
64
|
-
_this.addBoundsOverlay(bounds);
|
65
|
-
})
|
66
|
-
.on("mouseleave", "#documents [data-layer-id]", function() {
|
67
|
-
_this.removeBoundsOverlay();
|
68
|
-
});
|
69
|
-
|
70
|
-
return this;
|
71
|
-
|
72
|
-
};
|
@@ -0,0 +1 @@
|
|
1
|
+
//= require_tree ./viewers
|
@@ -0,0 +1,25 @@
|
|
1
|
+
//= require geoblacklight/viewers/viewer
|
2
|
+
|
3
|
+
GeoBlacklight.Viewer.Iiif = GeoBlacklight.Viewer.extend({
|
4
|
+
load: function() {
|
5
|
+
this.adjustLayout();
|
6
|
+
|
7
|
+
this.map = L.map(this.element, {
|
8
|
+
center: [0, 0],
|
9
|
+
crs: L.CRS.Simple,
|
10
|
+
zoom: 0
|
11
|
+
});
|
12
|
+
|
13
|
+
this.iiifLayer = L.tileLayer.iiif(this.data.url)
|
14
|
+
.addTo(this.map);
|
15
|
+
},
|
16
|
+
|
17
|
+
adjustLayout: function() {
|
18
|
+
|
19
|
+
// hide attribute table
|
20
|
+
$('#table-container').hide();
|
21
|
+
|
22
|
+
// expand viewer element
|
23
|
+
$(this.element).parent().attr('class', 'col-md-12');
|
24
|
+
}
|
25
|
+
});
|
@@ -0,0 +1,54 @@
|
|
1
|
+
//= require geoblacklight/viewers/viewer
|
2
|
+
|
3
|
+
GeoBlacklight.Viewer.Map = GeoBlacklight.Viewer.extend({
|
4
|
+
|
5
|
+
options: {
|
6
|
+
/**
|
7
|
+
* Initial bounds of map
|
8
|
+
* @type {L.LatLngBounds}
|
9
|
+
*/
|
10
|
+
bbox: [[-85, -180], [85, 180]]
|
11
|
+
},
|
12
|
+
|
13
|
+
basemap: L.tileLayer(
|
14
|
+
'https://otile{s}-s.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
|
15
|
+
attribution: '© <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, Tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="//developer.mapquest.com/content/osm/mq_logo.png">',
|
16
|
+
maxZoom: 18,
|
17
|
+
worldCopyJump: true,
|
18
|
+
subdomains: '1234' // see http://developer.mapquest.com/web/products/open/map
|
19
|
+
}
|
20
|
+
),
|
21
|
+
|
22
|
+
overlay: L.layerGroup(),
|
23
|
+
|
24
|
+
load: function() {
|
25
|
+
this.map = L.map(this.element).fitBounds(this.options.bbox);
|
26
|
+
this.map.addLayer(this.basemap);
|
27
|
+
this.map.addLayer(this.overlay);
|
28
|
+
if (this.data.map !== 'index') {
|
29
|
+
this.addBoundsOverlay(this.options.bbox);
|
30
|
+
}
|
31
|
+
},
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Add a bounding box overlay to map.
|
35
|
+
* @param {L.LatLngBounds} bounds Leaflet LatLngBounds
|
36
|
+
*/
|
37
|
+
addBoundsOverlay: function(bounds) {
|
38
|
+
if (bounds instanceof L.LatLngBounds) {
|
39
|
+
this.overlay.addLayer(L.polygon([
|
40
|
+
bounds.getSouthWest(),
|
41
|
+
bounds.getSouthEast(),
|
42
|
+
bounds.getNorthEast(),
|
43
|
+
bounds.getNorthWest()
|
44
|
+
]));
|
45
|
+
}
|
46
|
+
},
|
47
|
+
|
48
|
+
/**
|
49
|
+
* Remove bounding box overlay from map.
|
50
|
+
*/
|
51
|
+
removeBoundsOverlay: function() {
|
52
|
+
this.overlay.clearLayers();
|
53
|
+
}
|
54
|
+
});
|
@@ -0,0 +1,14 @@
|
|
1
|
+
// base viewer
|
2
|
+
GeoBlacklight.Viewer = L.Class.extend({
|
3
|
+
options: {},
|
4
|
+
|
5
|
+
initialize: function(el, options) {
|
6
|
+
this.element = el;
|
7
|
+
this.data = $(el).data();
|
8
|
+
|
9
|
+
L.Util.setOptions(this, options);
|
10
|
+
|
11
|
+
// trigger viewer load function
|
12
|
+
this.load();
|
13
|
+
}
|
14
|
+
});
|
@@ -0,0 +1,73 @@
|
|
1
|
+
//= require geoblacklight/viewers/map
|
2
|
+
|
3
|
+
GeoBlacklight.Viewer.Wms = GeoBlacklight.Viewer.Map.extend({
|
4
|
+
|
5
|
+
load: function() {
|
6
|
+
this.options.bbox = L.bboxToBounds(this.data.mapBbox);
|
7
|
+
this.map = L.map(this.element).fitBounds(this.options.bbox);
|
8
|
+
this.map.addLayer(this.basemap);
|
9
|
+
this.map.addLayer(this.overlay);
|
10
|
+
|
11
|
+
if (this.data.available) {
|
12
|
+
this.addPreviewLayer();
|
13
|
+
this.addOpacityControl();
|
14
|
+
} else {
|
15
|
+
this.addBoundsOverlay(this.options.bbox);
|
16
|
+
}
|
17
|
+
},
|
18
|
+
|
19
|
+
addPreviewLayer: function() {
|
20
|
+
var wmsLayer = L.tileLayer.wms(this.data.url, {
|
21
|
+
layers: this.data.layerId,
|
22
|
+
format: 'image/png',
|
23
|
+
transparent: true,
|
24
|
+
tiled: true,
|
25
|
+
CRS: 'EPSG:900913',
|
26
|
+
opacity: 0.75
|
27
|
+
});
|
28
|
+
this.overlay.addLayer(wmsLayer);
|
29
|
+
this.setupInspection();
|
30
|
+
},
|
31
|
+
|
32
|
+
addOpacityControl: function() {
|
33
|
+
this.map.addControl(new L.Control.LayerOpacity(this.overlay));
|
34
|
+
},
|
35
|
+
|
36
|
+
setupInspection: function() {
|
37
|
+
var _this = this;
|
38
|
+
this.map.on('click', function(e) {
|
39
|
+
spinner = '<span id="attribute-table"><i class="fa fa-spinner fa-spin fa-3x fa-align-center"></i></span>';
|
40
|
+
$('#attribute-table').replaceWith(spinner);
|
41
|
+
var wmsoptions = {
|
42
|
+
URL: _this.data.url,
|
43
|
+
LAYERS: _this.data.layerId,
|
44
|
+
BBOX: _this.map.getBounds().toBBoxString(),
|
45
|
+
WIDTH: $('#map').width(),
|
46
|
+
HEIGHT: $('#map').height(),
|
47
|
+
QUERY_LAYERS: _this.data.layerId,
|
48
|
+
X: Math.round(e.containerPoint.x),
|
49
|
+
Y: Math.round(e.containerPoint.y)
|
50
|
+
};
|
51
|
+
|
52
|
+
$.ajax({
|
53
|
+
type: 'POST',
|
54
|
+
url: '/wms/handle',
|
55
|
+
data: wmsoptions,
|
56
|
+
success: function(data) {
|
57
|
+
if (data.hasOwnProperty('error')) {
|
58
|
+
$('#attribute-table').html('Could not find that feature');
|
59
|
+
return;
|
60
|
+
}
|
61
|
+
var t = $('<table id="attribute-table" class="table table-hover table-condensed table-responsive table-striped table-bordered"><thead><tr><th>Attribute</th><th>Value</th></tr></thead><tbody>');
|
62
|
+
$.each(data.values, function(i, val) {
|
63
|
+
t.append('<tr><td>' + val[0] + '</td><td>' + val[1] + '</tr>');
|
64
|
+
});
|
65
|
+
$('#attribute-table').replaceWith(t);
|
66
|
+
},
|
67
|
+
fail: function(error) {
|
68
|
+
console.log(error);
|
69
|
+
}
|
70
|
+
});
|
71
|
+
});
|
72
|
+
}
|
73
|
+
});
|
@@ -24,17 +24,6 @@ module GeoblacklightHelper
|
|
24
24
|
document_available? && @document.downloadable?
|
25
25
|
end
|
26
26
|
|
27
|
-
def abstract_truncator(abstract)
|
28
|
-
if (abstract)
|
29
|
-
if (abstract.length > 150)
|
30
|
-
html = abstract.slice(0,150) + content_tag(:span, ("..." + link_to("more", "#", :id =>"more-abstract", :data => {no_turbolink: true})).html_safe, :id => "abstract-trunc") + content_tag(:span, abstract.slice(150,abstract.length), :id => "abstract-full", :class => "hidden")
|
31
|
-
else
|
32
|
-
html = abstract
|
33
|
-
end
|
34
|
-
content_tag(:span, html.html_safe)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
27
|
def snippit(text)
|
39
28
|
if (text)
|
40
29
|
if (text.length > 150)
|
@@ -3,8 +3,8 @@
|
|
3
3
|
<%= render 'upper_metadata', locals: { document: document} %>
|
4
4
|
|
5
5
|
<div class='row'>
|
6
|
-
<div class="col-md-8">
|
7
|
-
<%= content_tag :div, id: 'map', data: { map: 'item',
|
6
|
+
<div id='viewer-container' class="col-md-8">
|
7
|
+
<%= 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[:solr_bbox], 'catalog-path'=> catalog_index_path, available: document_available? } do %>
|
8
8
|
<% end %>
|
9
9
|
</div>
|
10
10
|
<div id='table-container' class='col-md-4'><div id='attribute-table' ></div></div>
|
@@ -36,12 +36,14 @@
|
|
36
36
|
<%= link_to("Download #{@document[:dc_format_s]}", document.direct_download[:download], 'contentUrl' => document.direct_download[:download]) %>
|
37
37
|
</li>
|
38
38
|
<% end %>
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
<% if document.download_types.present? %>
|
40
|
+
<li role="presentation" class="dropdown-header">Generated</li>
|
41
|
+
<% document.download_types.each do |type| %>
|
42
|
+
<%= content_tag(:li) do %>
|
43
|
+
<% link_to("Download #{type[0].capitalize}", '', data: { download_path: "#{download_path(document[:layer_slug_s], type: type[0])}" }) %>
|
44
|
+
<% end %>
|
45
|
+
<% end %>
|
46
|
+
<% end %>
|
45
47
|
</ul>
|
46
48
|
</div>
|
47
49
|
<% elsif document.restricted? && document.same_institution? %>
|
@@ -2,26 +2,23 @@
|
|
2
2
|
<div class="geoblacklight-view-panel">
|
3
3
|
|
4
4
|
<dl class="dl-horizontal">
|
5
|
+
<% unless document['dct_provenance_s'].nil? %>
|
6
|
+
<dt>Institution</dt>
|
7
|
+
<dd><%= document['dct_provenance_s'] %></dd>
|
8
|
+
<% end %>
|
5
9
|
<% unless document['dc_creator_sm'].nil? %>
|
6
10
|
<dt>Author</dt>
|
7
11
|
<dd itemprop="author"><%= document['dc_creator_sm'].join(', ') %> </dd>
|
8
|
-
|
12
|
+
<% end %>
|
9
13
|
<% unless document['dc_publisher_s'].nil? %>
|
10
14
|
<dt>Publisher</dt>
|
11
15
|
<dd itemprop="publisher"><%= document['dc_publisher_s'] %> </dd>
|
12
|
-
|
13
|
-
|
14
|
-
<dd itemprop="dateCreated"><%= document['solr_year_i'] %> </dd>
|
15
|
-
<dt>Abstract</dt>
|
16
|
-
<dd id="" itemprop="description"><%= abstract_truncator(document['dc_description_s']) %> </dd>
|
16
|
+
<% end %>
|
17
|
+
<%= render 'abstract_metadata' %>
|
17
18
|
<% unless document['dct_isPartOf_sm'].nil? %>
|
18
19
|
<dt>Collection</dt>
|
19
20
|
<dd itemprop="isPartOf"><%= document['dct_isPartOf_sm'].sort.uniq.join(', ') %> </dd>
|
20
21
|
<% end %>
|
21
|
-
<% if document['dct_provenance_s'] == 'Stanford' and not document['dc_identifier_s'].nil? %>
|
22
|
-
<dt>Citation</dt>
|
23
|
-
<dd itemprop="url"><%= link_to document['dc_identifier_s'], document['dc_identifier_s'] %> </dd>
|
24
|
-
<% end %>
|
25
22
|
<% unless document['dct_spatial_sm'].nil? %>
|
26
23
|
<dt>Places</dt>
|
27
24
|
<dd itemprop="spatial"><%= render_facet_links('dct_spatial_sm', document['dct_spatial_sm']) %> </dd>
|
@@ -34,5 +31,9 @@
|
|
34
31
|
<dt>Years</dt>
|
35
32
|
<dd itemprop="temporal"><%= document['dct_temporal_sm'].sort.uniq.join(', ') %> </dd>
|
36
33
|
<% end %>
|
34
|
+
<% if !@document.references.nil? && !@document.references.url.nil? %>
|
35
|
+
<dt>More details at</dt>
|
36
|
+
<dd itemprop="url"><%= link_to @document.references.url.endpoint %></dd>
|
37
|
+
<% end %>
|
37
38
|
</dl>
|
38
39
|
</div>
|
data/geoblacklight.gemspec
CHANGED
@@ -6,10 +6,10 @@ require 'geoblacklight/version'
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'geoblacklight'
|
8
8
|
spec.version = Geoblacklight::VERSION
|
9
|
-
spec.authors = ['Darren Hardy', 'Jack Reed']
|
10
|
-
spec.email = ['drh@stanford.edu', 'pjreed@stanford.edu']
|
9
|
+
spec.authors = ['Mike Graves', 'Darren Hardy', 'Eliot Jordan', 'Jack Reed']
|
10
|
+
spec.email = ['mgraves@mit.edu', 'drh@stanford.edu', 'eliotj@princeton.edu', 'pjreed@stanford.edu']
|
11
11
|
spec.summary = 'A discovery platform for geospatial holdings'
|
12
|
-
spec.description = 'GeoBlacklight
|
12
|
+
spec.description = 'GeoBlacklight provides a world-class discovery platform for geospatial (GIS) holdings. It is an open collaborative project aiming to build off of the successes of the Blacklight Solr-powered discovery interface and the multi-institutional OpenGeoportal federated metadata sharing communities.'
|
13
13
|
spec.homepage = 'http://github.com/geoblacklight/geoblacklight'
|
14
14
|
spec.license = 'Apache 2.0'
|
15
15
|
|
data/lib/geoblacklight.rb
CHANGED
@@ -6,6 +6,7 @@ module Geoblacklight
|
|
6
6
|
require 'geoblacklight/controller_override'
|
7
7
|
require 'geoblacklight/exceptions'
|
8
8
|
require 'geoblacklight/view_helper_override'
|
9
|
+
require 'geoblacklight/item_viewer'
|
9
10
|
require 'geoblacklight/solr_document'
|
10
11
|
require 'geoblacklight/wms_layer'
|
11
12
|
require 'geoblacklight/download'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Geoblacklight
|
2
|
+
class ItemViewer
|
3
|
+
def initialize(references)
|
4
|
+
@references = references
|
5
|
+
end
|
6
|
+
|
7
|
+
def viewer_protocol
|
8
|
+
return 'leaflet' if viewer_preference.nil?
|
9
|
+
viewer_preference.keys.first.to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
def viewer_endpoint
|
13
|
+
return '' if viewer_preference.nil?
|
14
|
+
viewer_preference.values.first.to_s
|
15
|
+
end
|
16
|
+
|
17
|
+
def wms
|
18
|
+
@references.wms
|
19
|
+
end
|
20
|
+
|
21
|
+
def iiif
|
22
|
+
@references.iiif
|
23
|
+
end
|
24
|
+
|
25
|
+
def viewer_preference
|
26
|
+
[wms, iiif].compact.map(&:to_hash).first
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -4,6 +4,8 @@ module Geoblacklight
|
|
4
4
|
extend Blacklight::Solr::Document
|
5
5
|
|
6
6
|
delegate :download_types, to: :references
|
7
|
+
delegate :viewer_protocol, to: :item_viewer
|
8
|
+
delegate :viewer_endpoint, to: :item_viewer
|
7
9
|
|
8
10
|
def available?
|
9
11
|
public? || same_institution?
|
@@ -18,7 +20,7 @@ module Geoblacklight
|
|
18
20
|
end
|
19
21
|
|
20
22
|
def downloadable?
|
21
|
-
download_types.present? && available?
|
23
|
+
(direct_download || download_types.present?) && available?
|
22
24
|
end
|
23
25
|
|
24
26
|
def download_types
|
@@ -37,6 +39,10 @@ module Geoblacklight
|
|
37
39
|
get(:dct_provenance_s).downcase == Settings.INSTITUTION.downcase
|
38
40
|
end
|
39
41
|
|
42
|
+
def item_viewer
|
43
|
+
ItemViewer.new(references)
|
44
|
+
end
|
45
|
+
|
40
46
|
def itemtype
|
41
47
|
"http://schema.org/Dataset"
|
42
48
|
end
|
@@ -38,7 +38,7 @@ feature 'Download layer' do
|
|
38
38
|
expect(page).to have_css 'a', text: 'Download Shapefile'
|
39
39
|
find('button.download-dropdown-toggle').click
|
40
40
|
expect(page).to have_css 'li.dropdown-header', text: 'Original'
|
41
|
-
expect(page).to have_css 'li.dropdown-header', text: '
|
41
|
+
expect(page).to have_css 'li.dropdown-header', text: 'Generated'
|
42
42
|
expect(page).to have_css 'li a', text: 'Download Shapefile'
|
43
43
|
expect(page).to have_css 'li a', text: 'Download Kmz'
|
44
44
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Geoblacklight::ItemViewer do
|
4
|
+
let(:document) { SolrDocument.new(document_attributes) }
|
5
|
+
let(:document_attributes) { {} }
|
6
|
+
let(:references) { document.references }
|
7
|
+
let(:item_viewer) { Geoblacklight::ItemViewer.new(references) }
|
8
|
+
describe 'viewer_preference' do
|
9
|
+
describe 'for no references' do
|
10
|
+
it 'returns nil' do
|
11
|
+
expect(item_viewer.viewer_preference).to be_nil
|
12
|
+
end
|
13
|
+
end
|
14
|
+
describe 'for wms reference' do
|
15
|
+
let(:document_attributes) {
|
16
|
+
{
|
17
|
+
dct_references_s: {
|
18
|
+
'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://www.example.com/wms',
|
19
|
+
'http://iiif.io/api/image' => 'http://www.example.com/iiif'
|
20
|
+
}.to_json
|
21
|
+
}
|
22
|
+
}
|
23
|
+
it 'wms if wms is present' do
|
24
|
+
expect(item_viewer.viewer_preference).to eq wms: 'http://www.example.com/wms'
|
25
|
+
end
|
26
|
+
end
|
27
|
+
describe 'for iiif only reference' do
|
28
|
+
let(:document_attributes) {
|
29
|
+
{
|
30
|
+
dct_references_s: {
|
31
|
+
'http://iiif.io/api/image' => 'http://www.example.com/iiif'
|
32
|
+
}.to_json
|
33
|
+
}
|
34
|
+
}
|
35
|
+
it 'returns iiif' do
|
36
|
+
expect(item_viewer.viewer_preference).to eq iiif: 'http://www.example.com/iiif'
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -31,6 +31,17 @@ describe Geoblacklight::References do
|
|
31
31
|
)
|
32
32
|
)
|
33
33
|
}
|
34
|
+
let(:typical_arcgrid) {
|
35
|
+
Geoblacklight::References.new(
|
36
|
+
SolrDocument.new(
|
37
|
+
dc_format_s: 'ArcGRID',
|
38
|
+
dct_references_s: {
|
39
|
+
'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://hgl.harvard.edu:8080/geoserver/wms',
|
40
|
+
'http://www.opengis.net/def/serviceType/ogc/wfs' => 'http://hgl.harvard.edu:8080/geoserver/wfs'
|
41
|
+
}.to_json
|
42
|
+
)
|
43
|
+
)
|
44
|
+
}
|
34
45
|
let(:complex_shapefile) {
|
35
46
|
Geoblacklight::References.new(
|
36
47
|
SolrDocument.new(
|
@@ -54,6 +65,17 @@ describe Geoblacklight::References do
|
|
54
65
|
}.to_json
|
55
66
|
)
|
56
67
|
}
|
68
|
+
let(:simple_iiif_image) {
|
69
|
+
Geoblacklight::References.new(
|
70
|
+
SolrDocument.new(
|
71
|
+
dc_format_s: 'Raster',
|
72
|
+
dct_references_s: {
|
73
|
+
'http://schema.org/url' => 'http://arks.princeton.edu/ark:/88435/02870w62c',
|
74
|
+
'http://iiif.io/api/image' => 'http://libimages.princeton.edu/loris2/pudl0076%2Fmap_pownall%2F00000001.jp2/info.json'
|
75
|
+
}.to_json
|
76
|
+
)
|
77
|
+
)
|
78
|
+
}
|
57
79
|
describe 'format' do
|
58
80
|
it 'should return format' do
|
59
81
|
expect(complex_shapefile.format).to eq 'Shapefile'
|
@@ -111,6 +133,10 @@ describe Geoblacklight::References do
|
|
111
133
|
expect(typical_ogp_geotiff.downloads_by_format.count).to eq 1
|
112
134
|
expect(typical_ogp_geotiff.downloads_by_format[:geotiff][:wms]).to eq 'http://hgl.harvard.edu:8080/geoserver/wms'
|
113
135
|
end
|
136
|
+
it 'returns arcgrid' do
|
137
|
+
expect(typical_arcgrid.downloads_by_format.count).to eq 1
|
138
|
+
expect(typical_arcgrid.downloads_by_format[:arcgrid][:wms]).to eq 'http://hgl.harvard.edu:8080/geoserver/wms'
|
139
|
+
end
|
114
140
|
it 'does not return shapefile if wms and wfs are not present' do
|
115
141
|
expect(no_service_shapefile.downloads_by_format).to be_nil
|
116
142
|
end
|
@@ -33,6 +33,21 @@ describe Geoblacklight::SolrDocument do
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
end
|
36
|
+
describe '#downloadable?' do
|
37
|
+
describe 'available direct download' do
|
38
|
+
let(:document_attributes) {
|
39
|
+
{
|
40
|
+
dc_rights_s: 'Public',
|
41
|
+
dct_references_s: {
|
42
|
+
'http://schema.org/downloadUrl' => 'http://example.com/direct/data.zip'
|
43
|
+
}.to_json
|
44
|
+
}
|
45
|
+
}
|
46
|
+
it 'will be downloadable' do
|
47
|
+
expect(document.downloadable?).to be_truthy
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
36
51
|
describe '#same_institution?' do
|
37
52
|
describe 'within the same institution' do
|
38
53
|
let(:document_attributes) { { dct_provenance_s: 'STANFORD' } }
|
@@ -86,6 +101,48 @@ describe Geoblacklight::SolrDocument do
|
|
86
101
|
expect(document.direct_download).to be_nil
|
87
102
|
end
|
88
103
|
end
|
104
|
+
describe 'item_viewer' do
|
105
|
+
let(:document_attributes) { {} }
|
106
|
+
it 'is a ItemViewer' do
|
107
|
+
expect(document.item_viewer).to be_an Geoblacklight::ItemViewer
|
108
|
+
end
|
109
|
+
end
|
110
|
+
describe 'viewer_protocol' do
|
111
|
+
describe 'with a wms reference' do
|
112
|
+
let(:document_attributes) {
|
113
|
+
{
|
114
|
+
dct_references_s: {
|
115
|
+
'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://www.example.com/wms'
|
116
|
+
}.to_json
|
117
|
+
}
|
118
|
+
}
|
119
|
+
it 'returns wms protocol' do
|
120
|
+
expect(document.viewer_protocol).to eq 'wms'
|
121
|
+
end
|
122
|
+
end
|
123
|
+
let(:document_attributes) { {} }
|
124
|
+
it 'returns leaflet protocol' do
|
125
|
+
expect(document.viewer_protocol).to eq 'leaflet'
|
126
|
+
end
|
127
|
+
end
|
128
|
+
describe 'viewer_endpoint' do
|
129
|
+
describe 'with a wms reference' do
|
130
|
+
let(:document_attributes) {
|
131
|
+
{
|
132
|
+
dct_references_s: {
|
133
|
+
'http://www.opengis.net/def/serviceType/ogc/wms' => 'http://www.example.com/wms'
|
134
|
+
}.to_json
|
135
|
+
}
|
136
|
+
}
|
137
|
+
it 'returns wms endpoint' do
|
138
|
+
expect(document.viewer_endpoint).to eq 'http://www.example.com/wms'
|
139
|
+
end
|
140
|
+
end
|
141
|
+
let(:document_attributes) { {} }
|
142
|
+
it 'returns no endpoint' do
|
143
|
+
expect(document.viewer_endpoint).to eq ''
|
144
|
+
end
|
145
|
+
end
|
89
146
|
describe 'checked_endpoint' do
|
90
147
|
let(:document_attributes) { {} }
|
91
148
|
let(:reference) { Geoblacklight::Reference.new(['http://www.opengis.net/def/serviceType/ogc/wms', 'http://www.example.com/wms']) }
|
@@ -0,0 +1,152 @@
|
|
1
|
+
/*
|
2
|
+
* Leaflet-IIIF 0.0.2
|
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
|
+
// Try to center the map a bit
|
48
|
+
map.setView([-_this.options.tileSize / 2, _this.options.tileSize / 4], 1);
|
49
|
+
|
50
|
+
// Set maxZoom for map
|
51
|
+
map._layersMaxZoom = _this.maxZoom;
|
52
|
+
|
53
|
+
// Call add TileLayer
|
54
|
+
L.TileLayer.prototype.onAdd.call(_this, map);
|
55
|
+
|
56
|
+
// Reset tile sizes to handle non 256x256 IIIF tiles
|
57
|
+
_this.on('tileload', function(tile, url) {
|
58
|
+
|
59
|
+
var height = tile.tile.naturalHeight,
|
60
|
+
width = tile.tile.naturalWidth;
|
61
|
+
|
62
|
+
// No need to resize if tile is 256 x 256
|
63
|
+
if (height === 256 && width === 256) return;
|
64
|
+
|
65
|
+
tile.tile.style.width = width + 'px';
|
66
|
+
tile.tile.style.height = height + 'px';
|
67
|
+
|
68
|
+
});
|
69
|
+
});
|
70
|
+
},
|
71
|
+
_getInfo: function() {
|
72
|
+
var _this = this;
|
73
|
+
|
74
|
+
// Look for a way to do this without jQuery
|
75
|
+
$.getJSON(_this._infoUrl)
|
76
|
+
.done(function(data) {
|
77
|
+
_this.y = data.height;
|
78
|
+
_this.x = data.width;
|
79
|
+
|
80
|
+
var profile,
|
81
|
+
tierSizes = [],
|
82
|
+
scale,
|
83
|
+
width_,
|
84
|
+
height_,
|
85
|
+
tilesX_,
|
86
|
+
tilesY_;
|
87
|
+
|
88
|
+
// Set quality based off of IIIF version
|
89
|
+
if (data.profile instanceof Array) {
|
90
|
+
profile = data.profile[0];
|
91
|
+
}else {
|
92
|
+
profile = data.profile;
|
93
|
+
}
|
94
|
+
switch (profile) {
|
95
|
+
case 'http://library.stanford.edu/iiif/image-api/compliance.html#level1':
|
96
|
+
_this.quality = 100;
|
97
|
+
break;
|
98
|
+
case 'http://library.stanford.edu/iiif/image-api/1.1/compliance.html':
|
99
|
+
_this.quality = 'native';
|
100
|
+
break;
|
101
|
+
case 'http://iiif.io/api/image/2/level2.json':
|
102
|
+
_this.quality = 'default';
|
103
|
+
break;
|
104
|
+
}
|
105
|
+
|
106
|
+
ceilLog2 = function(x) {
|
107
|
+
return Math.ceil(Math.log(x) / Math.LN2);
|
108
|
+
};
|
109
|
+
|
110
|
+
// Calculates maxZoom for the layer
|
111
|
+
_this.maxZoom = Math.max(ceilLog2(_this.x / _this.options.tileSize),
|
112
|
+
ceilLog2(_this.y / _this.options.tileSize));
|
113
|
+
|
114
|
+
for (var i = 0; i <= _this.maxZoom; i++) {
|
115
|
+
scale = Math.pow(2, _this.maxZoom - i);
|
116
|
+
width_ = Math.ceil(_this.x / scale);
|
117
|
+
height_ = Math.ceil(_this.y / scale);
|
118
|
+
tilesX_ = Math.ceil(width_ / _this.options.tileSize);
|
119
|
+
tilesY_ = Math.ceil(height_ / _this.options.tileSize);
|
120
|
+
tierSizes.push([tilesX_, tilesY_]);
|
121
|
+
}
|
122
|
+
_this._tierSizes = tierSizes;
|
123
|
+
|
124
|
+
// Resolved Deferred to initiate tilelayer load
|
125
|
+
_this._infoDeferred.resolve();
|
126
|
+
});
|
127
|
+
},
|
128
|
+
_infoToBaseUrl: function() {
|
129
|
+
return this._infoUrl.replace('info.json', '');
|
130
|
+
},
|
131
|
+
_templateUrl: function() {
|
132
|
+
return this._infoToBaseUrl() + '{region}/{size}/{rotation}/{quality}.{format}';
|
133
|
+
},
|
134
|
+
_tileShouldBeLoaded: function(coords) {
|
135
|
+
var _this = this,
|
136
|
+
zoom = _this._map.getZoom(),
|
137
|
+
sizes = _this._tierSizes[zoom],
|
138
|
+
x = coords.x,
|
139
|
+
y = (coords.y);
|
140
|
+
|
141
|
+
if (!sizes) return false;
|
142
|
+
if (x < 0 || sizes[0] <= x || y < 0 || sizes[1] <= y) {
|
143
|
+
return false;
|
144
|
+
}else {
|
145
|
+
return true;
|
146
|
+
}
|
147
|
+
}
|
148
|
+
});
|
149
|
+
|
150
|
+
L.tileLayer.iiif = function(url, options) {
|
151
|
+
return new L.TileLayer.Iiif(url, options);
|
152
|
+
};
|
@@ -0,0 +1,7 @@
|
|
1
|
+
(function(c){function g(b,a){this.element=b;this.options=c.extend({},h,a);c(this.element).data("max-height",this.options.maxHeight);c(this.element).data("height-margin",this.options.heightMargin);delete this.options.maxHeight;if(this.options.embedCSS&&!k){var d=".readmore-js-toggle, .readmore-js-section { "+this.options.sectionCSS+" } .readmore-js-section { overflow: hidden; }",e=document.createElement("style");e.type="text/css";e.styleSheet?e.styleSheet.cssText=d:e.appendChild(document.createTextNode(d));
|
2
|
+
document.getElementsByTagName("head")[0].appendChild(e);k=!0}this._defaults=h;this._name=f;this.init()}var f="readmore",h={speed:100,maxHeight:200,heightMargin:16,moreLink:'<a href="#">Read More</a>',lessLink:'<a href="#">Close</a>',embedCSS:!0,sectionCSS:"display: block; width: 100%;",startOpen:!1,expandedClass:"readmore-js-expanded",collapsedClass:"readmore-js-collapsed",beforeToggle:function(){},afterToggle:function(){}},k=!1;g.prototype={init:function(){var b=this;c(this.element).each(function(){var a=
|
3
|
+
c(this),d=a.css("max-height").replace(/[^-\d\.]/g,"")>a.data("max-height")?a.css("max-height").replace(/[^-\d\.]/g,""):a.data("max-height"),e=a.data("height-margin");"none"!=a.css("max-height")&&a.css("max-height","none");b.setBoxHeight(a);if(a.outerHeight(!0)<=d+e)return!0;a.addClass("readmore-js-section "+b.options.collapsedClass).data("collapsedHeight",d);a.after(c(b.options.startOpen?b.options.lessLink:b.options.moreLink).on("click",function(c){b.toggleSlider(this,a,c)}).addClass("readmore-js-toggle"));
|
4
|
+
b.options.startOpen||a.css({height:d})});c(window).on("resize",function(a){b.resizeBoxes()})},toggleSlider:function(b,a,d){d.preventDefault();var e=this;d=newLink=sectionClass="";var f=!1;d=c(a).data("collapsedHeight");c(a).height()<=d?(d=c(a).data("expandedHeight")+"px",newLink="lessLink",f=!0,sectionClass=e.options.expandedClass):(newLink="moreLink",sectionClass=e.options.collapsedClass);e.options.beforeToggle(b,a,f);c(a).animate({height:d},{duration:e.options.speed,complete:function(){e.options.afterToggle(b,
|
5
|
+
a,f);c(b).replaceWith(c(e.options[newLink]).on("click",function(b){e.toggleSlider(this,a,b)}).addClass("readmore-js-toggle"));c(this).removeClass(e.options.collapsedClass+" "+e.options.expandedClass).addClass(sectionClass)}})},setBoxHeight:function(b){var a=b.clone().css({height:"auto",width:b.width(),overflow:"hidden"}).insertAfter(b),c=a.outerHeight(!0);a.remove();b.data("expandedHeight",c)},resizeBoxes:function(){var b=this;c(".readmore-js-section").each(function(){var a=c(this);b.setBoxHeight(a);
|
6
|
+
(a.height()>a.data("expandedHeight")||a.hasClass(b.options.expandedClass)&&a.height()<a.data("expandedHeight"))&&a.css("height",a.data("expandedHeight"))})},destroy:function(){var b=this;c(this.element).each(function(){var a=c(this);a.removeClass("readmore-js-section "+b.options.collapsedClass+" "+b.options.expandedClass).css({"max-height":"",height:"auto"}).next(".readmore-js-toggle").remove();a.removeData()})}};c.fn[f]=function(b){var a=arguments;if(void 0===b||"object"===typeof b)return this.each(function(){if(c.data(this,
|
7
|
+
"plugin_"+f)){var a=c.data(this,"plugin_"+f);a.destroy.apply(a)}c.data(this,"plugin_"+f,new g(this,b))});if("string"===typeof b&&"_"!==b[0]&&"init"!==b)return this.each(function(){var d=c.data(this,"plugin_"+f);d instanceof g&&"function"===typeof d[b]&&d[b].apply(d,Array.prototype.slice.call(a,1))})}})(jQuery);
|
metadata
CHANGED
@@ -1,15 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: geoblacklight
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
+
- Mike Graves
|
7
8
|
- Darren Hardy
|
9
|
+
- Eliot Jordan
|
8
10
|
- Jack Reed
|
9
11
|
autorequire:
|
10
12
|
bindir: bin
|
11
13
|
cert_chain: []
|
12
|
-
date: 2014-12-
|
14
|
+
date: 2014-12-10 00:00:00.000000000 Z
|
13
15
|
dependencies:
|
14
16
|
- !ruby/object:Gem::Dependency
|
15
17
|
name: blacklight
|
@@ -235,12 +237,14 @@ dependencies:
|
|
235
237
|
- - ">="
|
236
238
|
- !ruby/object:Gem::Version
|
237
239
|
version: '0'
|
238
|
-
description: GeoBlacklight
|
239
|
-
|
240
|
-
|
241
|
-
|
240
|
+
description: GeoBlacklight provides a world-class discovery platform for geospatial
|
241
|
+
(GIS) holdings. It is an open collaborative project aiming to build off of the successes
|
242
|
+
of the Blacklight Solr-powered discovery interface and the multi-institutional OpenGeoportal
|
243
|
+
federated metadata sharing communities.
|
242
244
|
email:
|
245
|
+
- mgraves@mit.edu
|
243
246
|
- drh@stanford.edu
|
247
|
+
- eliotj@princeton.edu
|
244
248
|
- pjreed@stanford.edu
|
245
249
|
executables: []
|
246
250
|
extensions: []
|
@@ -259,8 +263,8 @@ files:
|
|
259
263
|
- app/assets/fonts/geoblacklight.ttf
|
260
264
|
- app/assets/fonts/geoblacklight.woff
|
261
265
|
- app/assets/images/blacklight/logo.png
|
262
|
-
- app/assets/javascripts/geoblacklight/application.js
|
263
266
|
- app/assets/javascripts/geoblacklight/geoblacklight.js
|
267
|
+
- app/assets/javascripts/geoblacklight/modules.js
|
264
268
|
- app/assets/javascripts/geoblacklight/modules/collapse.js
|
265
269
|
- app/assets/javascripts/geoblacklight/modules/download.js
|
266
270
|
- app/assets/javascripts/geoblacklight/modules/geosearch.js
|
@@ -268,6 +272,11 @@ files:
|
|
268
272
|
- app/assets/javascripts/geoblacklight/modules/item.js
|
269
273
|
- app/assets/javascripts/geoblacklight/modules/layer_opacity.js
|
270
274
|
- app/assets/javascripts/geoblacklight/modules/results.js
|
275
|
+
- app/assets/javascripts/geoblacklight/viewers.js
|
276
|
+
- app/assets/javascripts/geoblacklight/viewers/iiif.js
|
277
|
+
- app/assets/javascripts/geoblacklight/viewers/map.js
|
278
|
+
- app/assets/javascripts/geoblacklight/viewers/viewer.js
|
279
|
+
- app/assets/javascripts/geoblacklight/viewers/wms.js
|
271
280
|
- app/assets/stylesheets/geoblacklight/_geoblacklight.css.scss
|
272
281
|
- app/assets/stylesheets/geoblacklight/_styles.css.scss
|
273
282
|
- app/assets/stylesheets/geoblacklight/application.css.scss
|
@@ -282,6 +291,7 @@ files:
|
|
282
291
|
- app/controllers/download_controller.rb
|
283
292
|
- app/controllers/wms_controller.rb
|
284
293
|
- app/helpers/geoblacklight_helper.rb
|
294
|
+
- app/views/catalog/_abstract_metadata.html.erb
|
285
295
|
- app/views/catalog/_document_split.html.erb
|
286
296
|
- app/views/catalog/_facet_tag_item.html.erb
|
287
297
|
- app/views/catalog/_facet_tag_layout.html.erb
|
@@ -313,6 +323,7 @@ files:
|
|
313
323
|
- lib/geoblacklight/download/shapefile_download.rb
|
314
324
|
- lib/geoblacklight/engine.rb
|
315
325
|
- lib/geoblacklight/exceptions.rb
|
326
|
+
- lib/geoblacklight/item_viewer.rb
|
316
327
|
- lib/geoblacklight/reference.rb
|
317
328
|
- lib/geoblacklight/references.rb
|
318
329
|
- lib/geoblacklight/solr_document.rb
|
@@ -346,6 +357,7 @@ files:
|
|
346
357
|
- spec/lib/geoblacklight/download/kmz_download_spec.rb
|
347
358
|
- spec/lib/geoblacklight/download/shapefile_download_spec.rb
|
348
359
|
- spec/lib/geoblacklight/download_spec.rb
|
360
|
+
- spec/lib/geoblacklight/item_viewer_spec.rb
|
349
361
|
- spec/lib/geoblacklight/references_spec.rb
|
350
362
|
- spec/lib/geoblacklight/solr_document_spec.rb
|
351
363
|
- spec/lib/geoblacklight/view_helper_override_spec.rb
|
@@ -359,7 +371,9 @@ files:
|
|
359
371
|
- spec/views/catalog/_document_split.html.erb_spec.rb
|
360
372
|
- spec/views/catalog/_index_split.html.erb_spec.rb
|
361
373
|
- template.rb
|
374
|
+
- vendor/assets/javascripts/leaflet-iiif.js
|
362
375
|
- vendor/assets/javascripts/native.history.js
|
376
|
+
- vendor/assets/javascripts/readmore.min.js
|
363
377
|
homepage: http://github.com/geoblacklight/geoblacklight
|
364
378
|
licenses:
|
365
379
|
- Apache 2.0
|
@@ -410,6 +424,7 @@ test_files:
|
|
410
424
|
- spec/lib/geoblacklight/download/kmz_download_spec.rb
|
411
425
|
- spec/lib/geoblacklight/download/shapefile_download_spec.rb
|
412
426
|
- spec/lib/geoblacklight/download_spec.rb
|
427
|
+
- spec/lib/geoblacklight/item_viewer_spec.rb
|
413
428
|
- spec/lib/geoblacklight/references_spec.rb
|
414
429
|
- spec/lib/geoblacklight/solr_document_spec.rb
|
415
430
|
- spec/lib/geoblacklight/view_helper_override_spec.rb
|