blacklight_allmaps 0.2.0 → 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/README.md +47 -6
- data/Rakefile +4 -0
- data/app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.esm.js +41 -0
- data/app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.esm.js.map +1 -1
- data/app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.js +41 -0
- data/app/assets/javascripts/blacklight/allmaps/blacklight-allmaps.js.map +1 -1
- data/app/controllers/allmaps/annotations_controller.rb +65 -0
- data/app/helpers/blacklight/allmaps/application_helper.rb +1 -1
- data/app/javascript/blacklight/allmaps/index.js +6 -0
- data/app/javascript/blacklight/allmaps/update_georef_links.js +36 -0
- data/app/jobs/blacklight/allmaps/store_sidecar_annotation.rb +4 -1
- data/app/models/concerns/blacklight/allmaps/solr_document.rb +1 -2
- data/app/views/allmaps/show/_blacklight.html.erb +1 -1
- data/app/views/allmaps/show/_geoblacklight.html.erb +1 -1
- data/app/views/allmaps/sidebar/_allmaps.html.erb +4 -32
- data/app/views/annotations/_annotation.json.jbuilder +1 -0
- data/app/views/annotations/_pagination.json.jbuilder +9 -0
- data/app/views/annotations/index.json.jbuilder +4 -0
- data/app/views/annotations/show.json.jbuilder +1 -0
- data/app/views/catalog/_show_allmaps_tabbed_viewer_container.html.erb +3 -3
- data/config/locales/allmaps.en.yml +11 -0
- data/config/routes.rb +7 -0
- data/lib/blacklight/allmaps/tasks/index.rake +6 -57
- data/lib/blacklight/allmaps/tasks/sidecars.rake +9 -0
- data/lib/blacklight/allmaps/version.rb +1 -1
- data/lib/generators/blacklight/allmaps/blacklight_generator.rb +48 -0
- data/lib/generators/blacklight/allmaps/config_generator.rb +2 -54
- data/lib/generators/blacklight/allmaps/geoblacklight_generator.rb +50 -0
- data/lib/generators/blacklight/allmaps/install_generator.rb +10 -0
- metadata +26 -7
- data/app/controllers/blacklight/allmaps/application_controller.rb +0 -6
- data/app/jobs/blacklight/allmaps/application_job.rb +0 -6
- data/app/mailers/blacklight/allmaps/application_mailer.rb +0 -8
- data/app/models/blacklight/allmaps/application_record.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1b77dce03fda3d3aab9db13861e8e1fc6b0dc8e39db47dcf75a8dc8ee34a27f2
|
4
|
+
data.tar.gz: 83e85dc411bcacefcb92b0b9b12701e778c58116e6cefda56768de040f0d7c50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b182818f63f0e5a5fca137c8e7fbb8373a8e7955ffb93650a9fb0ccae01fbe2daaecedf29967c73bb5617c86cd92672653c67291bb3fe8244e0459180d4f205a
|
7
|
+
data.tar.gz: c9419afe74db352bdf7160b3900a856914b73f2171f9f13b0425dbe8087feb8b6142ccf78f000ec8dc4f545ce8064b938dec9452ee72a4417e37fd4ae0899b7b
|
data/README.md
CHANGED
@@ -36,6 +36,27 @@ LIGHT=blacklight bundle exec rails generate blacklight:allmaps:install
|
|
36
36
|
LIGHT=geoblacklight bundle exec rails generate blacklight:allmaps:install
|
37
37
|
```
|
38
38
|
|
39
|
+
## CatalogController Configuration
|
40
|
+
|
41
|
+
Configure options for local use are set into the `catalog_controller.rb` file.
|
42
|
+
|
43
|
+
### Blacklight
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
# Blacklight::Allmaps Viewer
|
47
|
+
config.show.partials.insert(1, :blacklight_allmaps)
|
48
|
+
config.default_solr_unique_key = "id"
|
49
|
+
config.default_georeferenced_field = "bl_georeferenced_bsi"
|
50
|
+
config.default_iiif_manifest_field = "iiif_manifest_url_ssi"
|
51
|
+
```
|
52
|
+
|
53
|
+
### GeoBlacklight
|
54
|
+
```ruby
|
55
|
+
# Blacklight::Allmaps Viewer
|
56
|
+
config.default_solr_unique_key = "id"
|
57
|
+
config.default_georeferenced_field = "gbl_georeferenced_b"
|
58
|
+
```
|
59
|
+
|
39
60
|
## Rake Tasks
|
40
61
|
|
41
62
|
### Seed Fixtures
|
@@ -61,6 +82,13 @@ The rake task here kicks off a background harvest process that walks through you
|
|
61
82
|
rake blacklight_allmaps:sidecars:harvest:allmaps
|
62
83
|
```
|
63
84
|
|
85
|
+
Alternatively, you can harvest Allmaps data for a list of identifers
|
86
|
+
|
87
|
+
```bash
|
88
|
+
# For Blacklight or GeoBlacklight
|
89
|
+
rake "blacklight_allmaps:sidecars:harvest_ids[id1 id2 ...]"
|
90
|
+
```
|
91
|
+
|
64
92
|
### Populate the Georeferenced Facet
|
65
93
|
|
66
94
|
We expose the georeferenced items in the Blacklight user interface via a Georeferenced facet:
|
@@ -68,11 +96,8 @@ We expose the georeferenced items in the Blacklight user interface via a Georefe
|
|
68
96
|
![Screen shot](doc/georeferenced_facet.png)
|
69
97
|
|
70
98
|
```bash
|
71
|
-
# For Blacklight
|
72
|
-
|
73
|
-
|
74
|
-
# For GeoBlacklight...
|
75
|
-
LIGHT=geoblacklight rake blacklight_allmaps:index:gbl_georeferenced_facet
|
99
|
+
# For Blacklight or GeoBlacklight
|
100
|
+
rake blacklight_allmaps:index:georeferenced_facet
|
76
101
|
```
|
77
102
|
|
78
103
|
## ActiveRecord Objects — Blacklight::Allmaps::Sidecar
|
@@ -81,7 +106,8 @@ Blacklight::Allmaps adopts the SolrDocumentSidecar "sidecar" pattern from [Spotl
|
|
81
106
|
|
82
107
|
We use this `document.sidecar_allmaps` object to hold the results of the Allmaps Annotation harvest task.
|
83
108
|
|
84
|
-
The Blacklight::Allmaps::Sidecar object contains:
|
109
|
+
The `Blacklight::Allmaps::Sidecar` object contains:
|
110
|
+
|
85
111
|
| Field | Value |
|
86
112
|
| --- | --- |
|
87
113
|
| id | primary key |
|
@@ -115,6 +141,21 @@ document.sidecar_allmaps =>
|
|
115
141
|
updated_at: Tue, 26 Mar 2024 16:39:42.427682000 UTC +00:00>
|
116
142
|
```
|
117
143
|
|
144
|
+
## Allmaps::AnnotationsController
|
145
|
+
|
146
|
+
We've added an annotations controller to the application to expose the `Blacklight::Allmaps::Sidecar` data we've harvested. This controller returns only JSON.
|
147
|
+
|
148
|
+
The `#fetch` method will query Allmaps in real time for updated annotation data, should a nightly harvest (rake) be insufficient for Solr indexing or local development needs.
|
149
|
+
|
150
|
+
```
|
151
|
+
Routes for Blacklight::Allmaps::Engine:
|
152
|
+
fetch_allmaps_annotation GET /allmaps/annotations/:id/fetch(.:format) allmaps/annotations#fetch {:format=>:json}
|
153
|
+
allmaps_annotations GET /allmaps/annotations(.:format) allmaps/annotations#index {:format=>:json}
|
154
|
+
allmaps_annotation GET /allmaps/annotations/:id(.:format) allmaps/annotations#show {:format=>:json}
|
155
|
+
PATCH /allmaps/annotations/:id(.:format) allmaps/annotations#update {:format=>:json}
|
156
|
+
PUT /allmaps/annotations/:id(.:format) allmaps/annotations#update {:format=>:json}
|
157
|
+
```
|
158
|
+
|
118
159
|
## Contributing
|
119
160
|
|
120
161
|
For Developer documentation see [doc/developer.md](./doc/development.md)
|
data/Rakefile
CHANGED
@@ -1,12 +1,16 @@
|
|
1
|
+
require "rails"
|
1
2
|
require "rake"
|
2
3
|
require "bundler"
|
4
|
+
|
3
5
|
Bundler::GemHelper.install_tasks
|
4
6
|
|
7
|
+
require "bundler/setup"
|
5
8
|
require "bundler/gem_tasks"
|
6
9
|
|
7
10
|
require "rspec/core/rake_task"
|
8
11
|
require "engine_cart/rake_task"
|
9
12
|
require "solr_wrapper"
|
13
|
+
require "solr_wrapper/rake_task"
|
10
14
|
require "blacklight/allmaps/rake_task"
|
11
15
|
|
12
16
|
task default: :ci
|
@@ -26771,6 +26771,47 @@ function initializeBlacklightMap() {
|
|
26771
26771
|
}
|
26772
26772
|
// app/javascript/blacklight/allmaps/initialize_blacklight_map.js
|
26773
26773
|
|
26774
|
+
// update_georef_links.js
|
26775
|
+
const updateGeorefLinks = async () => {
|
26776
|
+
const sidebarElement = document.getElementById('allmaps-sidebar');
|
26777
|
+
if (sidebarElement) {
|
26778
|
+
const manifestUrl = sidebarElement.getAttribute('data-iiif-manifest');
|
26779
|
+
const documentId = sidebarElement.getAttribute('data-document-id');
|
26780
|
+
const georefDiv = document.getElementById('georeferencing');
|
26781
|
+
const annotationUrlByIIIFUri = `https://annotations.allmaps.org/?url=${manifestUrl}`;
|
26782
|
+
|
26783
|
+
try {
|
26784
|
+
const response = await fetch(annotationUrlByIIIFUri);
|
26785
|
+
if (!response.ok) {
|
26786
|
+
georefDiv.innerHTML = `<a href="https://editor.allmaps.org/#/collection?url=${manifestUrl}" target="_blank">Georeference this item</a>`;
|
26787
|
+
|
26788
|
+
const csrfToken = document.querySelector("meta[name='csrf-token']").getAttribute("content");
|
26789
|
+
fetch(`/allmaps/annotations/${documentId}`, {
|
26790
|
+
method: "PUT",
|
26791
|
+
headers: {
|
26792
|
+
"X-CSRF-Token": csrfToken,
|
26793
|
+
"Content-Type": "application/json",
|
26794
|
+
"Accept": "application/json"
|
26795
|
+
}
|
26796
|
+
})
|
26797
|
+
.then(response => response.json())
|
26798
|
+
.then(data => console.log(data))
|
26799
|
+
.catch(error => console.error(error));
|
26800
|
+
|
26801
|
+
} else {
|
26802
|
+
const annotationUrl = response.url;
|
26803
|
+
georefDiv.innerHTML = `<a href="https://viewer.allmaps.org/?url=${annotationUrl}" target="_blank">View this georeferenced item</a>`;
|
26804
|
+
}
|
26805
|
+
} catch (error) {
|
26806
|
+
console.error("Fetch error:", error);
|
26807
|
+
}
|
26808
|
+
}
|
26809
|
+
};
|
26810
|
+
|
26774
26811
|
initializeGeoBlacklightMap();
|
26775
26812
|
initializeBlacklightMap();
|
26813
|
+
|
26814
|
+
document.addEventListener('DOMContentLoaded', () => {
|
26815
|
+
updateGeorefLinks();
|
26816
|
+
});
|
26776
26817
|
//# sourceMappingURL=blacklight-allmaps.esm.js.map
|