blacklight_allmaps 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.esm.js +26776 -0
- data/app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.esm.js.map +1 -0
- data/app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.js +26783 -0
- data/app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.js.map +1 -0
- data/app/assets/stylesheets/blacklight/allmaps/base.scss +9 -0
- data/app/javascript/blacklight/allmaps/index.js +11 -0
- data/app/javascript/blacklight/allmaps/initialize_blacklight_map.js +44 -0
- data/app/javascript/blacklight/allmaps/initialize_geoblacklight_map.js +53 -0
- data/app/javascript/blacklight/allmaps/leaflet_layer_opacity.js +69 -0
- data/app/views/allmaps/show/_blacklight.html.erb +1 -211
- data/app/views/allmaps/show/_geoblacklight.html.erb +1 -45
- data/app/views/catalog/_blacklight_allmaps.html.erb +5 -0
- data/app/views/catalog/{_show_default_viewer_container.html.erb → _show_allmaps_tabbed_viewer_container.html.erb} +1 -2
- data/lib/blacklight/allmaps/version.rb +1 -1
- data/lib/generators/blacklight/allmaps/config_generator.rb +51 -4
- metadata +19 -12
- data/app/assets/stylesheets/blacklight_allmaps/application.css +0 -15
- data/app/javascripts/map_controller.js +0 -39
- data/app/views/catalog/_show_main_content.html.erb +0 -58
@@ -0,0 +1,11 @@
|
|
1
|
+
import L from "leaflet";
|
2
|
+
import "leaflet-fullscreen";
|
3
|
+
import { WarpedMapLayer } from "@allmaps/leaflet"
|
4
|
+
import LayerOpacityControl from "leaflet_layer_opacity";
|
5
|
+
|
6
|
+
|
7
|
+
import { initializeGeoBlacklightMap } from "./initialize_geoblacklight_map";
|
8
|
+
initializeGeoBlacklightMap();
|
9
|
+
|
10
|
+
import { initializeBlacklightMap } from "./initialize_blacklight_map";
|
11
|
+
initializeBlacklightMap();
|
@@ -0,0 +1,44 @@
|
|
1
|
+
// initialize_blacklight_map.js
|
2
|
+
import L from 'leaflet';
|
3
|
+
import 'leaflet-fullscreen';
|
4
|
+
import LayerOpacityControl from 'leaflet_layer_opacity';
|
5
|
+
import { WarpedMapLayer } from '@allmaps/leaflet';
|
6
|
+
|
7
|
+
export function initializeBlacklightMap() {
|
8
|
+
document.addEventListener("DOMContentLoaded", () => {
|
9
|
+
if (document.getElementById("blacklight-allmaps-map") != null) {
|
10
|
+
const element = document.getElementById("blacklight-allmaps-map");
|
11
|
+
const allmaps_id = element.getAttribute("data-allmaps-id");
|
12
|
+
if (!element) return; // Exit if the element doesn't exist
|
13
|
+
|
14
|
+
const map = L.map("blacklight-allmaps-map", {
|
15
|
+
center: [0, 0],
|
16
|
+
zoom: 15,
|
17
|
+
zoomAnimationThreshold: 1
|
18
|
+
});
|
19
|
+
|
20
|
+
// Basemap and Attribution
|
21
|
+
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
22
|
+
attribution: "© <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors",
|
23
|
+
maxZoom: 18
|
24
|
+
}).addTo(map);
|
25
|
+
|
26
|
+
// Fullscreen control
|
27
|
+
map.addControl(new L.Control.Fullscreen({
|
28
|
+
position: "topright"
|
29
|
+
}));
|
30
|
+
|
31
|
+
// Annotation URL assumes the ID is passed dynamically to this function
|
32
|
+
const annotationUrl = `https://annotations.allmaps.org/manifests/${allmaps_id}`;
|
33
|
+
const warpedMapLayer = new WarpedMapLayer(annotationUrl).addTo(map);
|
34
|
+
|
35
|
+
// Layer opacity control
|
36
|
+
map.addControl(new LayerOpacityControl(warpedMapLayer));
|
37
|
+
|
38
|
+
map.on("warpedmapadded", () => {
|
39
|
+
map.fitBounds(warpedMapLayer.getBounds());
|
40
|
+
});
|
41
|
+
}
|
42
|
+
});
|
43
|
+
}
|
44
|
+
// app/javascript/blacklight/allmaps/initialize_blacklight_map.js
|
@@ -0,0 +1,53 @@
|
|
1
|
+
// initialize_geoblacklight_map.js
|
2
|
+
import L from 'leaflet';
|
3
|
+
import 'leaflet-fullscreen';
|
4
|
+
import LayerOpacityControl from 'leaflet_layer_opacity';
|
5
|
+
import { WarpedMapLayer } from '@allmaps/leaflet';
|
6
|
+
|
7
|
+
export function initializeGeoBlacklightMap() {
|
8
|
+
document.addEventListener("DOMContentLoaded", () => {
|
9
|
+
if (document.getElementById("geoblacklight-allmaps-map") != null) {
|
10
|
+
const element = document.getElementById("geoblacklight-allmaps-map");
|
11
|
+
const allmaps_id = element.getAttribute("data-allmaps-id");
|
12
|
+
const geoTab = document.getElementById("georeferenced-tab");
|
13
|
+
if (!element) return; // Exit if the element doesn't exist
|
14
|
+
|
15
|
+
const map = L.map("geoblacklight-allmaps-map", {
|
16
|
+
center: [0, 0],
|
17
|
+
zoom: 15,
|
18
|
+
zoomAnimationThreshold: 1
|
19
|
+
});
|
20
|
+
|
21
|
+
// Basemap and Attribution
|
22
|
+
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
23
|
+
attribution: "© <a href='https://www.openstreetmap.org/copyright'>OpenStreetMap</a> contributors",
|
24
|
+
maxZoom: 18
|
25
|
+
}).addTo(map);
|
26
|
+
|
27
|
+
// Fullscreen control
|
28
|
+
map.addControl(new L.Control.Fullscreen({
|
29
|
+
position: "topright"
|
30
|
+
}));
|
31
|
+
|
32
|
+
// Annotation URL assumes the ID is passed dynamically to this function
|
33
|
+
const annotationUrl = `https://annotations.allmaps.org/manifests/${allmaps_id}`;
|
34
|
+
const warpedMapLayer = new WarpedMapLayer(annotationUrl).addTo(map);
|
35
|
+
|
36
|
+
// Layer opacity control
|
37
|
+
map.addControl(new LayerOpacityControl(warpedMapLayer));
|
38
|
+
|
39
|
+
// Watch DOM to see active tab and
|
40
|
+
// Resize map to render correctly
|
41
|
+
const observer = new MutationObserver(function() {
|
42
|
+
if (geoTab.style.display !== "none") {
|
43
|
+
map.invalidateSize();
|
44
|
+
warpedMapLayer.addTo(map);
|
45
|
+
map.fitBounds(warpedMapLayer.getBounds());
|
46
|
+
}
|
47
|
+
});
|
48
|
+
|
49
|
+
observer.observe(geoTab, { attributes: true });
|
50
|
+
}
|
51
|
+
});
|
52
|
+
}
|
53
|
+
// app/javascript/blacklight/allmaps/initialize_geoblacklight_map.js
|
@@ -0,0 +1,69 @@
|
|
1
|
+
// leaflet_layer_opacity.js
|
2
|
+
import L from 'leaflet';
|
3
|
+
|
4
|
+
class LayerOpacityControl extends L.Control {
|
5
|
+
initialize(layer) {
|
6
|
+
super.initialize();
|
7
|
+
let options = { position: 'topleft' };
|
8
|
+
|
9
|
+
// Check if the layer is actually a layer group and adjust accordingly
|
10
|
+
if (typeof layer.getLayers !== 'undefined') {
|
11
|
+
options.layer = layer.getLayers()[0];
|
12
|
+
} else {
|
13
|
+
options.layer = layer;
|
14
|
+
}
|
15
|
+
|
16
|
+
L.Util.setOptions(this, options);
|
17
|
+
}
|
18
|
+
|
19
|
+
onAdd(map) {
|
20
|
+
const container = L.DomUtil.create('div', 'opacity-control unselectable');
|
21
|
+
const controlArea = L.DomUtil.create('div', 'opacity-area', container);
|
22
|
+
const handle = L.DomUtil.create('div', 'opacity-handle', container);
|
23
|
+
const handleArrowUp = L.DomUtil.create('div', 'opacity-arrow-up', handle);
|
24
|
+
const handleText = L.DomUtil.create('div', 'opacity-text', handle);
|
25
|
+
const handleArrowDown = L.DomUtil.create('div', 'opacity-arrow-down', handle);
|
26
|
+
const bottom = L.DomUtil.create('div', 'opacity-bottom', container);
|
27
|
+
|
28
|
+
L.DomEvent.stopPropagation(container);
|
29
|
+
L.DomEvent.disableClickPropagation(container);
|
30
|
+
|
31
|
+
this.setListeners(handle, bottom, handleText);
|
32
|
+
handle.style.top = `${handle.offsetTop - 13 + 50}px`;
|
33
|
+
handleText.innerHTML = `${parseInt(this.options.layer.options.opacity * 100, 10)}%`;
|
34
|
+
|
35
|
+
return container;
|
36
|
+
}
|
37
|
+
|
38
|
+
setListeners(handle, bottom, handleText) {
|
39
|
+
let start = false;
|
40
|
+
let startTop;
|
41
|
+
|
42
|
+
L.DomEvent.on(document, 'mousemove', (e) => {
|
43
|
+
if (!start) return;
|
44
|
+
const percentInverse = Math.max(0, Math.min(200, startTop + parseInt(e.clientY, 10) - start)) / 2;
|
45
|
+
handle.style.top = `${(percentInverse * 2) - 13}px`;
|
46
|
+
handleText.innerHTML = `${Math.round((1 - (percentInverse / 100)) * 100)}%`;
|
47
|
+
bottom.style.height = `${Math.max(0, ((100 - percentInverse) * 2) - 13)}px`;
|
48
|
+
bottom.style.top = `${Math.min(200, (percentInverse * 2) + 13)}px`;
|
49
|
+
this.options.layer.setOpacity(1 - (percentInverse / 100));
|
50
|
+
});
|
51
|
+
|
52
|
+
L.DomEvent.on(handle, 'mousedown', (e) => {
|
53
|
+
start = parseInt(e.clientY, 10);
|
54
|
+
startTop = handle.offsetTop - 12;
|
55
|
+
return false;
|
56
|
+
});
|
57
|
+
|
58
|
+
L.DomEvent.on(document, 'mouseup', () => {
|
59
|
+
start = null;
|
60
|
+
});
|
61
|
+
}
|
62
|
+
}
|
63
|
+
|
64
|
+
// Extend Leaflet's control factory to include this new control
|
65
|
+
L.Control.layerOpacity = function(layer, options) {
|
66
|
+
return new LayerOpacityControl(layer, options);
|
67
|
+
};
|
68
|
+
|
69
|
+
export default LayerOpacityControl;
|
@@ -1,213 +1,3 @@
|
|
1
1
|
<!-- Georeferenced Map -->
|
2
2
|
<h3 class="h6">Georeferenced Map</h3>
|
3
|
-
<div id="allmaps-map" class="mt-3 mb-3"
|
4
|
-
|
5
|
-
<!-- Leaflet -->
|
6
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.css">
|
7
|
-
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.min.js"></script>
|
8
|
-
|
9
|
-
<!-- Leaflet Fullscreen -->
|
10
|
-
<script src="https://cdn.jsdelivr.net/npm/leaflet-fullscreen@1.0.2/dist/Leaflet.fullscreen.min.js"></script>
|
11
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet-fullscreen@1.0.2/dist/leaflet.fullscreen.min.css">
|
12
|
-
|
13
|
-
<!-- Leaflet Layer Opacity -->
|
14
|
-
<script>
|
15
|
-
// Adopts the Mapbox opacity control into a Leaflet plugin
|
16
|
-
|
17
|
-
!function(global) {
|
18
|
-
'use strict';
|
19
|
-
|
20
|
-
L.Control.LayerOpacity = L.Control.extend({
|
21
|
-
initialize: function(layer) {
|
22
|
-
var options = { position: 'topleft' };
|
23
|
-
|
24
|
-
// check if layer is actually a layer group
|
25
|
-
if (typeof layer.getLayers !== 'undefined') {
|
26
|
-
|
27
|
-
// add first layer from layer group to options
|
28
|
-
options.layer = layer.getLayers()[0];
|
29
|
-
} else {
|
30
|
-
|
31
|
-
// add layer to options
|
32
|
-
options.layer = layer;
|
33
|
-
}
|
34
|
-
|
35
|
-
L.Util.setOptions(this, options);
|
36
|
-
},
|
37
|
-
|
38
|
-
onAdd: function(map) {
|
39
|
-
var container = L.DomUtil.create('div', 'opacity-control unselectable'),
|
40
|
-
controlArea = L.DomUtil.create('div', 'opacity-area', container),
|
41
|
-
handle = L.DomUtil.create('div', 'opacity-handle', container),
|
42
|
-
handleArrowUp = L.DomUtil.create('div', 'opacity-arrow-up', handle),
|
43
|
-
handleText = L.DomUtil.create('div', 'opacity-text', handle),
|
44
|
-
handleArrowDown = L.DomUtil.create('div', 'opacity-arrow-down', handle),
|
45
|
-
bottom = L.DomUtil.create('div', 'opacity-bottom', container);
|
46
|
-
|
47
|
-
L.DomEvent.stopPropagation(container);
|
48
|
-
L.DomEvent.disableClickPropagation(container);
|
49
|
-
|
50
|
-
this.setListeners(handle, bottom, handleText);
|
51
|
-
handle.style.top = handle.offsetTop - 13 + 50 + 'px';
|
52
|
-
handleText.innerHTML = parseInt(this.options.layer.options.opacity * 100) + '%';
|
53
|
-
return container;
|
54
|
-
},
|
55
|
-
|
56
|
-
setListeners: function(handle, bottom, handleText) {
|
57
|
-
var _this = this,
|
58
|
-
start = false,
|
59
|
-
startTop;
|
60
|
-
|
61
|
-
L.DomEvent.on(document, 'mousemove', function(e) {
|
62
|
-
if (!start) return;
|
63
|
-
var percentInverse = Math.max(0, Math.min(200, startTop + parseInt(e.clientY, 10) - start)) / 2;
|
64
|
-
handle.style.top = ((percentInverse * 2) - 13) + 'px';
|
65
|
-
handleText.innerHTML = Math.round((1 - (percentInverse / 100)) * 100) + '%';
|
66
|
-
bottom.style.height = Math.max(0, (((100 - percentInverse) * 2) - 13)) + 'px';
|
67
|
-
bottom.style.top = Math.min(200, (percentInverse * 2) + 13) + 'px';
|
68
|
-
_this.options.layer.setOpacity(1 - (percentInverse / 100));
|
69
|
-
});
|
70
|
-
|
71
|
-
L.DomEvent.on(handle, 'mousedown', function(e) {
|
72
|
-
start = parseInt(e.clientY, 10);
|
73
|
-
startTop = handle.offsetTop - 12;
|
74
|
-
return false;
|
75
|
-
});
|
76
|
-
|
77
|
-
L.DomEvent.on(document, 'mouseup', function(e) {
|
78
|
-
start = null;
|
79
|
-
});
|
80
|
-
}
|
81
|
-
});
|
82
|
-
}(this);
|
83
|
-
</script>
|
84
|
-
<style>
|
85
|
-
.leaflet-control.opacity-control {
|
86
|
-
background-color: #a9acb1;
|
87
|
-
border-radius: 15px;
|
88
|
-
color: black;
|
89
|
-
font: bold 18px 'Lucida Console', Monaco, monospace;
|
90
|
-
display: block;
|
91
|
-
height: 200px;
|
92
|
-
left: 11px;
|
93
|
-
position: relative;
|
94
|
-
top: 15px;
|
95
|
-
width: 5px;
|
96
|
-
|
97
|
-
.opacity-handle {
|
98
|
-
background-color: #fff;
|
99
|
-
border-radius: 4px;
|
100
|
-
border: 1px solid #eee;
|
101
|
-
cursor: ns-resize;
|
102
|
-
font-size: 10px;
|
103
|
-
height: 26px;
|
104
|
-
left: -11px;
|
105
|
-
line-height: 26px;
|
106
|
-
position: absolute;
|
107
|
-
text-align: center;
|
108
|
-
top: 0;
|
109
|
-
width: 26px;
|
110
|
-
@include map-control-shadow;
|
111
|
-
|
112
|
-
&:hover {
|
113
|
-
background-color: #f4f4f4;
|
114
|
-
}
|
115
|
-
}
|
116
|
-
|
117
|
-
.opacity-arrow-up {
|
118
|
-
color: #aaa;
|
119
|
-
position: absolute;
|
120
|
-
top: -11px;
|
121
|
-
text-align: center;
|
122
|
-
width: 100%;
|
123
|
-
|
124
|
-
&:before {
|
125
|
-
content: '=';
|
126
|
-
}
|
127
|
-
}
|
128
|
-
|
129
|
-
.opacity-arrow-down {
|
130
|
-
bottom: -10px;
|
131
|
-
color: #aaa;
|
132
|
-
position: absolute;
|
133
|
-
text-align: center;
|
134
|
-
width: 100%;
|
135
|
-
|
136
|
-
&:before {
|
137
|
-
content: '=';
|
138
|
-
}
|
139
|
-
}
|
140
|
-
|
141
|
-
.opacity-bottom {
|
142
|
-
background-color: #017afd;
|
143
|
-
border-radius: 15px;
|
144
|
-
display: block;
|
145
|
-
height: 137px;
|
146
|
-
left: 0px;
|
147
|
-
position: relative;
|
148
|
-
top: 63px;
|
149
|
-
width: 5px;
|
150
|
-
}
|
151
|
-
|
152
|
-
// Area underneath slider to prevent unintentioned map clicks
|
153
|
-
.opacity-area {
|
154
|
-
padding: 14px;
|
155
|
-
cursor: default;
|
156
|
-
height: 200px;
|
157
|
-
left: -11px;
|
158
|
-
position: absolute;
|
159
|
-
top: 0px;
|
160
|
-
width: 20px;
|
161
|
-
}
|
162
|
-
}
|
163
|
-
|
164
|
-
.opacity-control.unselectable {
|
165
|
-
-webkit-touch-callout: none;
|
166
|
-
-webkit-user-select: none;
|
167
|
-
-khtml-user-select: none;
|
168
|
-
-moz-user-select: none;
|
169
|
-
-ms-user-select: none;
|
170
|
-
user-select: none;
|
171
|
-
}
|
172
|
-
</style>
|
173
|
-
|
174
|
-
<!-- Allmaps -->
|
175
|
-
<script src="https://cdn.jsdelivr.net/npm/@allmaps/leaflet/dist/bundled/allmaps-leaflet-1.9.umd.js"></script>
|
176
|
-
|
177
|
-
<script>
|
178
|
-
document.addEventListener("DOMContentLoaded", () => {
|
179
|
-
const element = document.getElementById("allmaps-map");
|
180
|
-
|
181
|
-
const map = L.map("allmaps-map", {
|
182
|
-
center: [0, 0],
|
183
|
-
zoom: 15,
|
184
|
-
zoomAnimationThreshold: 1
|
185
|
-
});
|
186
|
-
|
187
|
-
// Basemap and Attribution
|
188
|
-
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
189
|
-
attribution: "© <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors",
|
190
|
-
maxZoom: 18
|
191
|
-
}).addTo(map);
|
192
|
-
|
193
|
-
// Fullscreen control
|
194
|
-
map.addControl(new L.Control.Fullscreen({
|
195
|
-
position: "topright"
|
196
|
-
}));
|
197
|
-
|
198
|
-
const annotationUrl = "https://annotations.allmaps.org/manifests/<%= document.sidecar_allmaps.allmaps_id %>";
|
199
|
-
const warpedMapLayer = new Allmaps.WarpedMapLayer(annotationUrl)
|
200
|
-
.addTo(map);
|
201
|
-
|
202
|
-
// Layer opacity control
|
203
|
-
map.addControl(new L.Control.LayerOpacity(warpedMapLayer));
|
204
|
-
|
205
|
-
map.on(
|
206
|
-
"warpedmapadded",
|
207
|
-
(event) => {
|
208
|
-
map.fitBounds(warpedMapLayer.getBounds());
|
209
|
-
},
|
210
|
-
map
|
211
|
-
);
|
212
|
-
});
|
213
|
-
</script>
|
3
|
+
<div id="blacklight-allmaps-map" data-allmaps-id="<%= document.sidecar_allmaps.allmaps_id %>" class="mt-3 mb-3"></div>
|
@@ -1,47 +1,3 @@
|
|
1
1
|
<!-- Georeferenced Map -->
|
2
2
|
<h3 class="h6">Georeferenced Map</h3>
|
3
|
-
<div id="allmaps-map" data-map-geom="<%= document.geometry.geojson %>"
|
4
|
-
|
5
|
-
<script src="https://cdn.jsdelivr.net/npm/@allmaps/leaflet/dist/bundled/allmaps-leaflet-1.9.umd.js"></script>
|
6
|
-
<script>
|
7
|
-
document.addEventListener("DOMContentLoaded", () => {
|
8
|
-
const element = document.getElementById("allmaps-map");
|
9
|
-
const value = element.getAttribute("data-map-geom");
|
10
|
-
const layer = L.geoJSON();
|
11
|
-
layer.addData(JSON.parse(value));
|
12
|
-
const bounds = layer.getBounds();
|
13
|
-
const annotationUrl = "https://annotations.allmaps.org/manifests/<%= document.sidecar_allmaps.allmaps_id %>";
|
14
|
-
const warpedMapLayer = new Allmaps.WarpedMapLayer(annotationUrl);
|
15
|
-
const geoTab = document.getElementById("georeferenced-tab");
|
16
|
-
const map = L.map("allmaps-map");
|
17
|
-
|
18
|
-
// Basemap and Attribution
|
19
|
-
L.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {
|
20
|
-
attribution: "© <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors",
|
21
|
-
maxZoom: 18
|
22
|
-
}).addTo(map);
|
23
|
-
|
24
|
-
// Fullscreen control
|
25
|
-
map.addControl(new L.Control.Fullscreen({
|
26
|
-
position: "topright"
|
27
|
-
}));
|
28
|
-
|
29
|
-
// Layer opacity control
|
30
|
-
map.addControl(new L.Control.LayerOpacity(warpedMapLayer));
|
31
|
-
|
32
|
-
// Leaflet: Multiple maps on the same page is a challenge...
|
33
|
-
// 1. Need to watch the page DOM mutate
|
34
|
-
// 2. When the georeferenced tab is visible, invalidate the map size
|
35
|
-
// 3. Add the WarpedMapLayer to the map
|
36
|
-
// 4. Fit the map to the GeoJSON bounds
|
37
|
-
const observer = new MutationObserver(function(){
|
38
|
-
if(geoTab.style.display !== "none"){
|
39
|
-
map.invalidateSize();
|
40
|
-
warpedMapLayer.addTo(map);
|
41
|
-
map.fitBounds(bounds);
|
42
|
-
}
|
43
|
-
});
|
44
|
-
|
45
|
-
observer.observe(geoTab, { attributes: true });
|
46
|
-
});
|
47
|
-
</script>
|
3
|
+
<div id="geoblacklight-allmaps-map" data-map-geom="<%= document.geometry.geojson %>" data-allmaps-id="<%= document.sidecar_allmaps.allmaps_id %>"></div>
|
@@ -39,8 +39,7 @@
|
|
39
39
|
</div>
|
40
40
|
<% end %>
|
41
41
|
|
42
|
-
<%=
|
43
|
-
<% end %>
|
42
|
+
<%= viewer_container %>
|
44
43
|
</div>
|
45
44
|
</div>
|
46
45
|
|
@@ -20,6 +20,7 @@ module Blacklight
|
|
20
20
|
append_to_file "config/initializers/assets.rb" do
|
21
21
|
"
|
22
22
|
# Blacklight Allmaps
|
23
|
+
Rails.application.config.assets.paths << Rails.root.join('vendor', 'assets', 'images')
|
23
24
|
Rails.application.config.assets.precompile += %w( blacklight/allmaps/allmaps-logo.svg )"
|
24
25
|
end
|
25
26
|
end
|
@@ -36,19 +37,42 @@ module Blacklight
|
|
36
37
|
def add_importmap_pins
|
37
38
|
append_to_file "config/importmap.rb" do
|
38
39
|
<<~CONTENT
|
39
|
-
pin "leaflet"
|
40
|
-
pin
|
40
|
+
pin "leaflet", to: "https://cdn.jsdelivr.net/npm/leaflet@1.9.4/dist/leaflet.js", preload: true
|
41
|
+
pin "leaflet-fullscreen", to: "https://cdn.jsdelivr.net/npm/leaflet-fullscreen@1.0.2/dist/Leaflet.fullscreen.min.js", preload: true
|
42
|
+
pin "@allmaps/leaflet", to: "https://cdn.jsdelivr.net/npm/@allmaps/leaflet/dist/bundled/allmaps-leaflet-1.9.umd.js", preload: true
|
41
43
|
CONTENT
|
42
44
|
end
|
43
45
|
end
|
44
46
|
|
47
|
+
def add_javascript
|
48
|
+
inject_into_file "app/assets/javascripts/application.js", after: "//= require blacklight/blacklight" do
|
49
|
+
"\n
|
50
|
+
// Required by Blacklight::Allmaps
|
51
|
+
//= require blacklight/allmaps/blacklight-allmaps"
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def add_bl_stylesheets
|
56
|
+
return unless ENV["LIGHT"] == "blacklight"
|
57
|
+
append_to_file "app/assets/stylesheets/blacklight.scss" do
|
58
|
+
"@import 'blacklight/allmaps/base';"
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def add_gbl_stylesheets
|
63
|
+
return unless ENV["LIGHT"] == "geoblacklight"
|
64
|
+
append_to_file "app/assets/stylesheets/application.scss" do
|
65
|
+
"@import 'blacklight/allmaps/base';"
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
45
69
|
def set_active_job_config
|
46
70
|
inject_into_file "config/environments/development.rb", " config.active_job.queue_adapter = :inline\n", after: "Rails.application.configure do\n"
|
47
71
|
end
|
48
72
|
|
49
73
|
def add_geoblacklight
|
50
74
|
return unless ENV["LIGHT"] == "geoblacklight"
|
51
|
-
append_to_file "Gemfile", '"geoblacklight", "4.
|
75
|
+
append_to_file "Gemfile", '"geoblacklight", "~> 4.4"'
|
52
76
|
end
|
53
77
|
|
54
78
|
def include_blacklight_allmaps_solrdocument
|
@@ -58,10 +82,33 @@ module Blacklight
|
|
58
82
|
end
|
59
83
|
end
|
60
84
|
|
85
|
+
def add_gbl_tabbed_viewer
|
86
|
+
return unless ENV["LIGHT"] == "geoblacklight"
|
87
|
+
# Use the tabbed viewer
|
88
|
+
inject_into_file "app/controllers/catalog_controller.rb", after: "config.show.partials << \"show_default_viewer_container\"" do
|
89
|
+
"\n
|
90
|
+
# Blacklight::Allmaps Tabbed Viewer
|
91
|
+
config.show.partials << \"show_allmaps_tabbed_viewer_container\""
|
92
|
+
end
|
93
|
+
|
94
|
+
# Remove the default viewer
|
95
|
+
gsub_file("app/controllers/catalog_controller.rb", "config.show.partials << \"show_default_viewer_container\"", "#config.show.partials << \"show_default_viewer_container\"")
|
96
|
+
end
|
97
|
+
|
98
|
+
def add_bl_allmaps_viewer
|
99
|
+
return unless ENV["LIGHT"] == "blacklight"
|
100
|
+
# Use the allmaps viewer
|
101
|
+
inject_into_file "app/controllers/catalog_controller.rb", after: "#config.show.thumbnail_field = 'thumbnail_path_ss'" do
|
102
|
+
"\n
|
103
|
+
# Blacklight::Allmaps Viewer
|
104
|
+
config.show.partials.insert(1, :blacklight_allmaps)"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
61
108
|
def add_bl_georeferenced_facet
|
62
109
|
return unless ENV["LIGHT"] == "blacklight"
|
63
110
|
inject_into_file "app/controllers/catalog_controller.rb", after: "config.add_facet_field 'subject_era_ssim', label: 'Era'" do
|
64
|
-
"\n config.add_facet_field 'bl_georeferenced_bsi', label: 'Georeferenced'"
|
111
|
+
"\n config.add_facet_field 'bl_georeferenced_bsi', label: 'Allmaps Georeferenced'"
|
65
112
|
end
|
66
113
|
end
|
67
114
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: blacklight_allmaps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eric Larson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: blacklight
|
@@ -34,16 +34,16 @@ dependencies:
|
|
34
34
|
name: httparty
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- - "
|
37
|
+
- - "~>"
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0'
|
39
|
+
version: '0.20'
|
40
40
|
type: :runtime
|
41
41
|
prerelease: false
|
42
42
|
version_requirements: !ruby/object:Gem::Requirement
|
43
43
|
requirements:
|
44
|
-
- - "
|
44
|
+
- - "~>"
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0'
|
46
|
+
version: '0.20'
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: solr_wrapper
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
@@ -156,7 +156,7 @@ dependencies:
|
|
156
156
|
- - ">="
|
157
157
|
- !ruby/object:Gem::Version
|
158
158
|
version: '0'
|
159
|
-
description: Description of
|
159
|
+
description: Description of Blacklight::Allmaps
|
160
160
|
email:
|
161
161
|
- ewlarson@gmail.com
|
162
162
|
executables: []
|
@@ -171,10 +171,17 @@ files:
|
|
171
171
|
- app/assets/images/blacklight/allmaps/blacklight-logo.png
|
172
172
|
- app/assets/images/blacklight/allmaps/geoblacklight-logo.png
|
173
173
|
- app/assets/images/blacklight/allmaps/logo.svg
|
174
|
-
- app/assets/
|
174
|
+
- app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.esm.js
|
175
|
+
- app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.esm.js.map
|
176
|
+
- app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.js
|
177
|
+
- app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.js.map
|
178
|
+
- app/assets/stylesheets/blacklight/allmaps/base.scss
|
175
179
|
- app/controllers/blacklight/allmaps/application_controller.rb
|
176
180
|
- app/helpers/blacklight/allmaps/application_helper.rb
|
177
|
-
- app/
|
181
|
+
- app/javascript/blacklight/allmaps/index.js
|
182
|
+
- app/javascript/blacklight/allmaps/initialize_blacklight_map.js
|
183
|
+
- app/javascript/blacklight/allmaps/initialize_geoblacklight_map.js
|
184
|
+
- app/javascript/blacklight/allmaps/leaflet_layer_opacity.js
|
178
185
|
- app/jobs/blacklight/allmaps/application_job.rb
|
179
186
|
- app/jobs/blacklight/allmaps/store_sidecar_annotation.rb
|
180
187
|
- app/mailers/blacklight/allmaps/application_mailer.rb
|
@@ -184,8 +191,8 @@ files:
|
|
184
191
|
- app/views/allmaps/show/_blacklight.html.erb
|
185
192
|
- app/views/allmaps/show/_geoblacklight.html.erb
|
186
193
|
- app/views/allmaps/sidebar/_allmaps.html.erb
|
187
|
-
- app/views/catalog/
|
188
|
-
- app/views/catalog/
|
194
|
+
- app/views/catalog/_blacklight_allmaps.html.erb
|
195
|
+
- app/views/catalog/_show_allmaps_tabbed_viewer_container.html.erb
|
189
196
|
- app/views/catalog/_show_sidebar.html.erb
|
190
197
|
- app/views/catalog/_show_sidebar_blacklight.html.erb
|
191
198
|
- app/views/catalog/_show_sidebar_geoblacklight.html.erb
|
@@ -225,5 +232,5 @@ requirements: []
|
|
225
232
|
rubygems_version: 3.4.21
|
226
233
|
signing_key:
|
227
234
|
specification_version: 4
|
228
|
-
summary: Blacklight
|
235
|
+
summary: Blacklight::Allmaps plugin
|
229
236
|
test_files: []
|
@@ -1,15 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
3
|
-
* listed below.
|
4
|
-
*
|
5
|
-
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
6
|
-
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
7
|
-
*
|
8
|
-
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
9
|
-
* compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
|
10
|
-
* files in this directory. Styles in this file should be added after the last require_* statement.
|
11
|
-
* It is generally better to create a new file per style scope.
|
12
|
-
*
|
13
|
-
*= require_tree .
|
14
|
-
*= require_self
|
15
|
-
*/
|