geoblacklight 6.0.0.pre.alpha.1 → 6.0.0.pre.alpha.2
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/.github/workflows/ruby.yml +1 -0
- data/app/components/geoblacklight/document/relations_container_component.html.erb +1 -0
- data/app/components/geoblacklight/document/relations_container_component.rb +12 -0
- data/app/components/geoblacklight/document/sidebar_component.html.erb +2 -3
- data/app/components/geoblacklight/download_links_component.rb +1 -1
- data/app/components/geoblacklight/index_map_legend_component.html.erb +6 -6
- data/app/components/geoblacklight/login_link_component.rb +1 -1
- data/app/components/geoblacklight/static_map_component.html.erb +1 -1
- data/app/controllers/relation_controller.rb +1 -1
- data/app/helpers/geoblacklight_helper.rb +1 -1
- data/app/javascript/geoblacklight/core.js +0 -2
- data/app/views/relation/index.html.erb +4 -2
- data/lib/generators/geoblacklight/templates/settings.yml +118 -114
- data/lib/geoblacklight/configuration/case_insensitive_settings.rb +59 -0
- data/lib/geoblacklight/configuration/fields_config.rb +33 -33
- data/lib/geoblacklight/configuration/layer_config.rb +28 -0
- data/lib/geoblacklight/configuration/leaflet_config.rb +8 -12
- data/lib/geoblacklight/configuration/leaflet_layers_config.rb +15 -3
- data/lib/geoblacklight/configuration/relationship_config.rb +15 -0
- data/lib/geoblacklight/configuration/relationships_config.rb +123 -0
- data/lib/geoblacklight/configuration/settings_builder.rb +118 -0
- data/lib/geoblacklight/configuration.rb +7 -2
- data/lib/geoblacklight/deprecation.rb +7 -0
- data/lib/geoblacklight/version.rb +1 -1
- data/lib/geoblacklight.rb +1 -1
- data/spec/components/geoblacklight/document/sidebar_component_spec.rb +48 -0
- data/spec/components/geoblacklight/login_link_component_spec.rb +1 -1
- data/spec/lib/geoblacklight/configuration/layer_config_spec.rb +71 -0
- data/spec/lib/geoblacklight/configuration/leaflet_layers_config_spec.rb +63 -0
- data/spec/lib/geoblacklight/configuration/settings_builder_spec.rb +177 -0
- data/spec/lib/geoblacklight/configuration_spec.rb +35 -0
- data/spec/lib/geoblacklight/relation/relation_response_spec.rb +4 -4
- data/spec/spec_helper.rb +5 -0
- metadata +14 -6
- data/app/javascript/geoblacklight/initializers/relations.js +0 -40
- data/app/views/catalog/_relations_container.html.erb +0 -1
- data/lib/geoblacklight/configuration/legacy_settings_builder.rb +0 -94
- data/spec/features/show_page_sidebar_static_map_spec.rb +0 -21
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
require "spec_helper"
|
|
2
|
+
|
|
3
|
+
RSpec.describe Geoblacklight::Configuration::SettingsBuilder do
|
|
4
|
+
describe ".build" do
|
|
5
|
+
subject(:config) { described_class.build }
|
|
6
|
+
|
|
7
|
+
it { is_expected.to be_a(Geoblacklight::Configuration) }
|
|
8
|
+
|
|
9
|
+
it "reads values from the real Settings (lowercase) constant" do
|
|
10
|
+
expect(config.institution).to eq(Settings.institution)
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
describe "#build" do
|
|
15
|
+
subject(:config) { described_class.new(settings: settings).build }
|
|
16
|
+
|
|
17
|
+
describe "reading lowercase keys" do
|
|
18
|
+
let(:settings) do
|
|
19
|
+
{
|
|
20
|
+
institution: "MIT",
|
|
21
|
+
fields: {title: "my_title_s"},
|
|
22
|
+
download_formats: {vector: ["GeoJSON"]},
|
|
23
|
+
leaflet: {selected_color: "#abc123", sidebar: true}
|
|
24
|
+
}
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
it "resolves top-level lowercase keys" do
|
|
28
|
+
expect(config.institution).to eq("MIT")
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
it "resolves nested lowercase keys" do
|
|
32
|
+
expect(config.fields.title).to eq("my_title_s")
|
|
33
|
+
expect(config.vector_download_formats).to eq(["GeoJSON"])
|
|
34
|
+
expect(config.leaflet_options.selected_color).to eq("#abc123")
|
|
35
|
+
expect(config.leaflet_options.sidebar).to be true
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
describe "reading uppercase keys (backwards compatibility)" do
|
|
40
|
+
let(:settings) do
|
|
41
|
+
{
|
|
42
|
+
INSTITUTION: "Stanford",
|
|
43
|
+
FIELDS: {TITLE: "dct_title_s"}
|
|
44
|
+
}
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
before { allow(Geoblacklight::Deprecation).to receive(:warn) }
|
|
48
|
+
|
|
49
|
+
it "resolves uppercase keys even though the builder asks case-insensitively" do
|
|
50
|
+
expect(config.institution).to eq("Stanford")
|
|
51
|
+
expect(config.fields.title).to eq("dct_title_s")
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
describe "deprecation warnings" do
|
|
56
|
+
before { allow(Geoblacklight::Deprecation).to receive(:warn) }
|
|
57
|
+
|
|
58
|
+
it "warns when an uppercase key is resolved" do
|
|
59
|
+
described_class.new(settings: {INSTITUTION: "MIT"}).build
|
|
60
|
+
expect(Geoblacklight::Deprecation).to have_received(:warn).with(a_string_matching(/INSTITUTION/i))
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
it "warns about nested uppercase keys" do
|
|
64
|
+
described_class.new(settings: {fields: {TITLE: "dct_title_s"}}).build
|
|
65
|
+
expect(Geoblacklight::Deprecation).to have_received(:warn).with(a_string_matching(/TITLE/i))
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
it "does not warn when keys are lowercase" do
|
|
69
|
+
described_class.new(settings: {institution: "MIT", fields: {title: "x"}}).build
|
|
70
|
+
expect(Geoblacklight::Deprecation).not_to have_received(:warn)
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
it "does not warn when a lowercase key shadows an uppercase one" do
|
|
74
|
+
described_class.new(settings: {institution: "lower", INSTITUTION: "UPPER"}).build
|
|
75
|
+
expect(Geoblacklight::Deprecation).not_to have_received(:warn)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
describe "when both cases are present" do
|
|
80
|
+
let(:settings) { {institution: "lower", INSTITUTION: "UPPER"} }
|
|
81
|
+
it "prefers the lowercase value" do
|
|
82
|
+
expect(config.institution).to eq("lower")
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
describe "missing keys" do
|
|
87
|
+
let(:settings) { {} }
|
|
88
|
+
it "fall back to the Configuration defaults" do
|
|
89
|
+
expect(config.institution).to eq("Stanford")
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
RSpec.describe Geoblacklight::Configuration::CaseInsensitiveSettings do
|
|
96
|
+
subject(:wrapper) { described_class.new(settings) }
|
|
97
|
+
|
|
98
|
+
describe "method access" do
|
|
99
|
+
let(:settings) { {ARCgis_BASE_URL: "https://example.com"} }
|
|
100
|
+
|
|
101
|
+
it "resolves keys case-insensitively" do
|
|
102
|
+
expect(wrapper.arcgis_base_url).to eq("https://example.com")
|
|
103
|
+
expect(wrapper.ARCGIS_BASE_URL).to eq("https://example.com")
|
|
104
|
+
expect(wrapper.Arcgis_Base_Url).to eq("https://example.com")
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
it "returns nil for unknown keys" do
|
|
108
|
+
expect(wrapper.does_not_exist).to be_nil
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
describe "[] access" do
|
|
113
|
+
let(:settings) { {INSTITUTION: "MIT"} }
|
|
114
|
+
|
|
115
|
+
it "resolves via bracket access" do
|
|
116
|
+
expect(wrapper[:institution]).to eq("MIT")
|
|
117
|
+
expect(wrapper[:INSTITUTION]).to eq("MIT")
|
|
118
|
+
end
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
describe "nested access" do
|
|
122
|
+
let(:settings) { {FIELDS: {TITLE: "dct_title_s"}} }
|
|
123
|
+
|
|
124
|
+
it "wraps nested hashes so chained access resolves" do
|
|
125
|
+
expect(wrapper.fields.title).to eq("dct_title_s")
|
|
126
|
+
expect(wrapper.FIELDS.TITLE).to eq("dct_title_s")
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
describe "lowercase preference" do
|
|
131
|
+
let(:settings) { {institution: "lower", INSTITUTION: "UPPER"} }
|
|
132
|
+
|
|
133
|
+
it "returns the lowercase value when both forms exist" do
|
|
134
|
+
expect(wrapper.institution).to eq("lower")
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
describe "to_h" do
|
|
139
|
+
let(:settings) { {FOO: "bar"} }
|
|
140
|
+
|
|
141
|
+
it "returns the underlying hash" do
|
|
142
|
+
expect(wrapper.to_h).to eq({FOO: "bar"})
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
|
|
146
|
+
describe "deprecation warnings" do
|
|
147
|
+
it "warns when an uppercase key is used" do
|
|
148
|
+
deprecation = double("deprecation")
|
|
149
|
+
expect(deprecation).to receive(:warn).with(a_string_matching(/INSTITUTION/i))
|
|
150
|
+
described_class.new({INSTITUTION: "MIT"}, deprecation: deprecation).institution
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
it "warns about nested uppercase keys" do
|
|
154
|
+
deprecation = double("deprecation")
|
|
155
|
+
allow(deprecation).to receive(:warn)
|
|
156
|
+
described_class.new({FIELDS: {TITLE: "x"}}, deprecation: deprecation).fields.title
|
|
157
|
+
expect(deprecation).to have_received(:warn).with(a_string_matching(/FIELDS/i))
|
|
158
|
+
expect(deprecation).to have_received(:warn).with(a_string_matching(/TITLE/i))
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
it "does not warn when the resolved key is lowercase" do
|
|
162
|
+
deprecation = double("deprecation")
|
|
163
|
+
expect(deprecation).not_to receive(:warn)
|
|
164
|
+
described_class.new({institution: "MIT"}, deprecation: deprecation).institution
|
|
165
|
+
end
|
|
166
|
+
|
|
167
|
+
it "does not warn when a lowercase key shadows an uppercase one" do
|
|
168
|
+
deprecation = double("deprecation")
|
|
169
|
+
expect(deprecation).not_to receive(:warn)
|
|
170
|
+
described_class.new({institution: "lower", INSTITUTION: "UPPER"}, deprecation: deprecation).institution
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
it "does not warn by default (no deprecation configured)" do
|
|
174
|
+
expect { described_class.new({INSTITUTION: "MIT"}).institution }.not_to raise_error
|
|
175
|
+
end
|
|
176
|
+
end
|
|
177
|
+
end
|
|
@@ -9,5 +9,40 @@ RSpec.describe Geoblacklight::Configuration do
|
|
|
9
9
|
it "returns a hash of options for leaflet" do
|
|
10
10
|
expect(leaflet_options.layers.index.keys).to eq(%i[DEFAULT UNAVAILABLE SELECTED])
|
|
11
11
|
end
|
|
12
|
+
|
|
13
|
+
it "uses LayerConfig instances for index configurations" do
|
|
14
|
+
expect(leaflet_options.layers.index[:DEFAULT]).to be_a(Geoblacklight::Configuration::LayerConfig)
|
|
15
|
+
expect(leaflet_options.layers.index[:DEFAULT].weight).to eq(1)
|
|
16
|
+
expect(leaflet_options.layers.index[:DEFAULT].radius).to eq(4)
|
|
17
|
+
expect(leaflet_options.layers.index[:DEFAULT].color).to eq("#7FCDBB")
|
|
18
|
+
expect(leaflet_options.layers.index[:DEFAULT].sr_color_name).to eq("Green")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "serializes layers options correctly with LayerConfig defaults" do
|
|
22
|
+
layers_hash = leaflet_options.to_h[:layers]
|
|
23
|
+
expect(layers_hash).to eq(
|
|
24
|
+
"detect_retina" => true,
|
|
25
|
+
"index" => {
|
|
26
|
+
DEFAULT: {
|
|
27
|
+
color: "#7FCDBB",
|
|
28
|
+
weight: 1,
|
|
29
|
+
radius: 4,
|
|
30
|
+
sr_color_name: "Green"
|
|
31
|
+
},
|
|
32
|
+
UNAVAILABLE: {
|
|
33
|
+
color: "#EDF8B1",
|
|
34
|
+
weight: 1,
|
|
35
|
+
radius: 4,
|
|
36
|
+
sr_color_name: "Yellow"
|
|
37
|
+
},
|
|
38
|
+
SELECTED: {
|
|
39
|
+
color: "#2C7FB8",
|
|
40
|
+
weight: 1,
|
|
41
|
+
radius: 4,
|
|
42
|
+
sr_color_name: "Blue"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
)
|
|
46
|
+
end
|
|
12
47
|
end
|
|
13
48
|
end
|
|
@@ -14,13 +14,13 @@ RSpec.describe Geoblacklight::Relation::RelationResponse do
|
|
|
14
14
|
|
|
15
15
|
describe "#method_missing" do
|
|
16
16
|
it "returns a hash of ancestor documents" do
|
|
17
|
-
expect(relation_resp.
|
|
18
|
-
expect(relation_resp.
|
|
17
|
+
expect(relation_resp.source_ancestors).to include("numFound")
|
|
18
|
+
expect(relation_resp.source_ancestors).to include("docs")
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
it "returns a hash of descendant documents" do
|
|
22
|
-
expect(relation_resp.
|
|
23
|
-
expect(relation_resp.
|
|
22
|
+
expect(relation_resp.source_descendants).to include("numFound")
|
|
23
|
+
expect(relation_resp.source_descendants).to include("docs")
|
|
24
24
|
end
|
|
25
25
|
|
|
26
26
|
it "raises no method error" do
|
data/spec/spec_helper.rb
CHANGED
|
@@ -44,6 +44,11 @@ Capybara.register_driver :chrome_headless do |app|
|
|
|
44
44
|
options.add_argument("--disable-gpu")
|
|
45
45
|
options.add_argument("--no-sandbox")
|
|
46
46
|
options.add_argument("--window-size=1280,1024")
|
|
47
|
+
# Return from #visit at DOMContentLoaded instead of waiting for the full
|
|
48
|
+
# window `load` event. GeoBlacklight pages pull basemap tiles and WMS/TMS
|
|
49
|
+
# layers from external hosts; in CI those requests can hang and prevent
|
|
50
|
+
# `load` from ever firing, causing Net::ReadTimeout on #visit.
|
|
51
|
+
options.page_load_strategy = :eager
|
|
47
52
|
|
|
48
53
|
# Allow longer TCP reads to prevent timeout in the case of loading fixture
|
|
49
54
|
# eee6150b-ce2f-4837-9d17-ce72a0c1c26f, as part of relations_spec.rb
|
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: 6.0.0.pre.alpha.
|
|
4
|
+
version: 6.0.0.pre.alpha.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mike Graves
|
|
@@ -10,7 +10,7 @@ authors:
|
|
|
10
10
|
- Jack Reed
|
|
11
11
|
bindir: bin
|
|
12
12
|
cert_chain: []
|
|
13
|
-
date: 2026-06-
|
|
13
|
+
date: 2026-06-27 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rails
|
|
@@ -436,6 +436,8 @@ files:
|
|
|
436
436
|
- app/components/geoblacklight/display_note_component.rb
|
|
437
437
|
- app/components/geoblacklight/document/citation_component.html.erb
|
|
438
438
|
- app/components/geoblacklight/document/citation_component.rb
|
|
439
|
+
- app/components/geoblacklight/document/relations_container_component.html.erb
|
|
440
|
+
- app/components/geoblacklight/document/relations_container_component.rb
|
|
439
441
|
- app/components/geoblacklight/document/sidebar_component.html.erb
|
|
440
442
|
- app/components/geoblacklight/document/sidebar_component.rb
|
|
441
443
|
- app/components/geoblacklight/document_component.html.erb
|
|
@@ -491,7 +493,6 @@ files:
|
|
|
491
493
|
- app/javascript/geoblacklight/index.js
|
|
492
494
|
- app/javascript/geoblacklight/initializers/metadata_download.js
|
|
493
495
|
- app/javascript/geoblacklight/initializers/popovers.js
|
|
494
|
-
- app/javascript/geoblacklight/initializers/relations.js
|
|
495
496
|
- app/javascript/geoblacklight/initializers/tooltips.js
|
|
496
497
|
- app/javascript/geoblacklight/initializers/truncation.js
|
|
497
498
|
- app/javascript/geoblacklight/leaflet/basemaps.js
|
|
@@ -521,7 +522,6 @@ files:
|
|
|
521
522
|
- app/views/catalog/_document_split.html.erb
|
|
522
523
|
- app/views/catalog/_home_text.html.erb
|
|
523
524
|
- app/views/catalog/_metadata.html.erb
|
|
524
|
-
- app/views/catalog/_relations_container.html.erb
|
|
525
525
|
- app/views/catalog/index.html.erb
|
|
526
526
|
- app/views/catalog/metadata.html.erb
|
|
527
527
|
- app/views/catalog/metadata/_content.html.erb
|
|
@@ -543,14 +543,19 @@ files:
|
|
|
543
543
|
- lib/geoblacklight.rb
|
|
544
544
|
- lib/geoblacklight/bounding_box.rb
|
|
545
545
|
- lib/geoblacklight/configuration.rb
|
|
546
|
+
- lib/geoblacklight/configuration/case_insensitive_settings.rb
|
|
546
547
|
- lib/geoblacklight/configuration/default_settings_builder.rb
|
|
547
548
|
- lib/geoblacklight/configuration/display_note_shown_config.rb
|
|
548
549
|
- lib/geoblacklight/configuration/fields_config.rb
|
|
550
|
+
- lib/geoblacklight/configuration/layer_config.rb
|
|
549
551
|
- lib/geoblacklight/configuration/leaflet_config.rb
|
|
550
552
|
- lib/geoblacklight/configuration/leaflet_layers_config.rb
|
|
551
553
|
- lib/geoblacklight/configuration/leaflet_sleep_config.rb
|
|
552
|
-
- lib/geoblacklight/configuration/
|
|
554
|
+
- lib/geoblacklight/configuration/relationship_config.rb
|
|
555
|
+
- lib/geoblacklight/configuration/relationships_config.rb
|
|
556
|
+
- lib/geoblacklight/configuration/settings_builder.rb
|
|
553
557
|
- lib/geoblacklight/constants.rb
|
|
558
|
+
- lib/geoblacklight/deprecation.rb
|
|
554
559
|
- lib/geoblacklight/download.rb
|
|
555
560
|
- lib/geoblacklight/download/csv_download.rb
|
|
556
561
|
- lib/geoblacklight/download/geojson_download.rb
|
|
@@ -604,6 +609,7 @@ files:
|
|
|
604
609
|
- spec/components/geoblacklight/attribute_table_component_spec.rb
|
|
605
610
|
- spec/components/geoblacklight/citation_component_spec.rb
|
|
606
611
|
- spec/components/geoblacklight/display_note_component_spec.rb
|
|
612
|
+
- spec/components/geoblacklight/document/sidebar_component_spec.rb
|
|
607
613
|
- spec/components/geoblacklight/document_component_spec.rb
|
|
608
614
|
- spec/components/geoblacklight/download_links_component_spec.rb
|
|
609
615
|
- spec/components/geoblacklight/header_icons_component_spec.rb
|
|
@@ -654,7 +660,6 @@ files:
|
|
|
654
660
|
- spec/features/search_spec.rb
|
|
655
661
|
- spec/features/show_page_download_spec.rb
|
|
656
662
|
- spec/features/show_page_metadata_spec.rb
|
|
657
|
-
- spec/features/show_page_sidebar_static_map_spec.rb
|
|
658
663
|
- spec/features/sms_spec.rb
|
|
659
664
|
- spec/features/suppressed_records_spec.rb
|
|
660
665
|
- spec/features/tilejson_spec.rb
|
|
@@ -741,6 +746,9 @@ files:
|
|
|
741
746
|
- spec/javascripts/metadata_download_button_spec.js
|
|
742
747
|
- spec/lib/geoblacklight/bounding_box_spec.rb
|
|
743
748
|
- spec/lib/geoblacklight/configuration/default_settings_builder_spec.rb
|
|
749
|
+
- spec/lib/geoblacklight/configuration/layer_config_spec.rb
|
|
750
|
+
- spec/lib/geoblacklight/configuration/leaflet_layers_config_spec.rb
|
|
751
|
+
- spec/lib/geoblacklight/configuration/settings_builder_spec.rb
|
|
744
752
|
- spec/lib/geoblacklight/configuration_spec.rb
|
|
745
753
|
- spec/lib/geoblacklight/download/csv_download_spec.rb
|
|
746
754
|
- spec/lib/geoblacklight/download/geojson_download_spec.rb
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const fadeIn = (element, duration) => {
|
|
2
|
-
element.style.opacity = 0
|
|
3
|
-
element.style.display = "block"
|
|
4
|
-
|
|
5
|
-
let start = null
|
|
6
|
-
function step(timestamp) {
|
|
7
|
-
if (!start) start = timestamp
|
|
8
|
-
const progress = timestamp - start
|
|
9
|
-
element.style.opacity = Math.min(progress / duration, 1)
|
|
10
|
-
if (progress < duration) {
|
|
11
|
-
window.requestAnimationFrame(step)
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
window.requestAnimationFrame(step)
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
// Set up the relations widgets by querying the relations endpoint
|
|
19
|
-
export default function initializeRelations() {
|
|
20
|
-
document.querySelectorAll('[data-relations="true"]').forEach((element) => {
|
|
21
|
-
const attributes = element.dataset
|
|
22
|
-
const relationUrl = `${attributes.url}/relations`
|
|
23
|
-
|
|
24
|
-
fetch(relationUrl, { headers: { "X-Requested-With": "XMLHttpRequest" } })
|
|
25
|
-
.then((response) => {
|
|
26
|
-
if (!response.ok) {
|
|
27
|
-
throw new Error("Network response was not ok")
|
|
28
|
-
}
|
|
29
|
-
return response.text()
|
|
30
|
-
})
|
|
31
|
-
.then((data) => {
|
|
32
|
-
const div = document.createElement("div")
|
|
33
|
-
div.innerHTML = data
|
|
34
|
-
element.appendChild(div)
|
|
35
|
-
div.style.display = "none"
|
|
36
|
-
fadeIn(div, 200)
|
|
37
|
-
})
|
|
38
|
-
.catch((error) => console.error("Error:", error))
|
|
39
|
-
})
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<%= content_tag(:div, nil, data: {relations: true, url: solr_document_path(document.id)}) %>
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
module Geoblacklight
|
|
2
|
-
class Configuration
|
|
3
|
-
# Builds a configuration from legacy (uppercase) settings
|
|
4
|
-
class LegacySettingsBuilder
|
|
5
|
-
def self.build
|
|
6
|
-
new.build
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def initialize
|
|
10
|
-
@configuration = Configuration.new
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
def build
|
|
14
|
-
@configuration.tap do |config|
|
|
15
|
-
config.arcgis_base_url = Settings.ARCGIS_BASE_URL
|
|
16
|
-
config.bbox_within_boost = Settings.BBOX_WITHIN_BOOST
|
|
17
|
-
config.overlap_ratio_boost = Settings.OVERLAP_RATIO_BOOST
|
|
18
|
-
config.display_notes_shown = Settings.DISPLAY_NOTES_SHOWN
|
|
19
|
-
config.institution = Settings.INSTITUTION
|
|
20
|
-
config.help_text = Settings.HELP_TEXT.to_h
|
|
21
|
-
config.sidebar_static_map = Settings.SIDEBAR_STATIC_MAP
|
|
22
|
-
config.iiif_drag_drop_link = Settings.IIIF_DRAG_DROP_LINK
|
|
23
|
-
config.homepage_map_geom = Settings.HOMEPAGE_MAP_GEOM
|
|
24
|
-
config.vector_download_formats = Settings.DOWNLOAD_FORMATS&.VECTOR
|
|
25
|
-
config.metadata_shown = Settings.METADATA_SHOWN
|
|
26
|
-
config.webservices_shown = Settings.WEBSERVICES_SHOWN
|
|
27
|
-
config.relationships_shown = Settings.RELATIONSHIPS_SHOWN
|
|
28
|
-
config.download_path = Settings.DOWNLOAD_PATH if Settings.DOWNLOAD_PATH
|
|
29
|
-
config.gbl_params = Settings.GBL_PARAMS
|
|
30
|
-
config.wms_params = Settings.WMS_PARAMS.to_h
|
|
31
|
-
config.timeout_wms = Settings.TIMEOUT_WMS
|
|
32
|
-
|
|
33
|
-
build_fields(config)
|
|
34
|
-
build_leaflet_options(config)
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
private
|
|
39
|
-
|
|
40
|
-
def build_leaflet_options(config)
|
|
41
|
-
config.leaflet_options.bounds_overlay = Settings.LEAFLET.BOUNDSOVERLAY.to_h
|
|
42
|
-
config.leaflet_options.selected_color = Settings.LEAFLET.SELECTED_COLOR
|
|
43
|
-
config.leaflet_options.sleep = Settings.LEAFLET.SLEEP.to_h.transform_keys(&:downcase)
|
|
44
|
-
config.leaflet_options.sidebar = Settings.LEAFLET.SIDEBAR
|
|
45
|
-
config.leaflet_options.layers = Settings.LEAFLET.LAYERS.to_h.transform_keys(&:downcase)
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
def build_fields(config)
|
|
49
|
-
config.fields.access_rights = Settings.FIELDS.ACCESS_RIGHTS
|
|
50
|
-
config.fields.alternative_title = Settings.FIELDS.ALTERNATIVE_TITLE
|
|
51
|
-
config.fields.centroid = Settings.FIELDS.CENTROID
|
|
52
|
-
config.fields.creator = Settings.FIELDS.CREATOR
|
|
53
|
-
config.fields.date_issued = Settings.FIELDS.DATE_ISSUED
|
|
54
|
-
config.fields.date_range = Settings.FIELDS.DATE_RANGE
|
|
55
|
-
config.fields.description = Settings.FIELDS.DESCRIPTION
|
|
56
|
-
config.fields.display_note = Settings.FIELDS.DISPLAY_NOTE
|
|
57
|
-
config.fields.format = Settings.FIELDS.FORMAT
|
|
58
|
-
config.fields.file_size = Settings.FIELDS.FILE_SIZE
|
|
59
|
-
config.fields.georeferenced = Settings.FIELDS.GEOREFERENCED
|
|
60
|
-
config.fields.id = Settings.FIELDS.ID
|
|
61
|
-
config.fields.identifier = Settings.FIELDS.IDENTIFIER
|
|
62
|
-
config.fields.index_year = Settings.FIELDS.INDEX_YEAR
|
|
63
|
-
config.fields.is_part_of = Settings.FIELDS.IS_PART_OF
|
|
64
|
-
config.fields.is_replaced_by = Settings.FIELDS.IS_REPLACED_BY
|
|
65
|
-
config.fields.theme = Settings.FIELDS.THEME
|
|
66
|
-
config.fields.keyword = Settings.FIELDS.KEYWORD
|
|
67
|
-
config.fields.language = Settings.FIELDS.LANGUAGE
|
|
68
|
-
config.fields.license = Settings.FIELDS.LICENSE
|
|
69
|
-
config.fields.member_of = Settings.FIELDS.MEMBER_OF
|
|
70
|
-
config.fields.metadata_version = Settings.FIELDS.METADATA_VERSION
|
|
71
|
-
config.fields.modified = Settings.FIELDS.MODIFIED
|
|
72
|
-
config.fields.overlap_field = Settings.FIELDS.OVERLAP_FIELD
|
|
73
|
-
config.fields.publisher = Settings.FIELDS.PUBLISHER
|
|
74
|
-
config.fields.provider = Settings.FIELDS.PROVIDER
|
|
75
|
-
config.fields.references = Settings.FIELDS.REFERENCES
|
|
76
|
-
config.fields.relation = Settings.FIELDS.RELATION
|
|
77
|
-
config.fields.replaces = Settings.FIELDS.REPLACES
|
|
78
|
-
config.fields.resource_class = Settings.FIELDS.RESOURCE_CLASS
|
|
79
|
-
config.fields.resource_type = Settings.FIELDS.RESOURCE_TYPE
|
|
80
|
-
config.fields.rights = Settings.FIELDS.RIGHTS
|
|
81
|
-
config.fields.rights_holder = Settings.FIELDS.RIGHTS_HOLDER
|
|
82
|
-
config.fields.source = Settings.FIELDS.SOURCE
|
|
83
|
-
config.fields.spatial_coverage = Settings.FIELDS.SPATIAL_COVERAGE
|
|
84
|
-
config.fields.geometry = Settings.FIELDS.GEOMETRY
|
|
85
|
-
config.fields.subject = Settings.FIELDS.SUBJECT
|
|
86
|
-
config.fields.suppressed = Settings.FIELDS.SUPPRESSED
|
|
87
|
-
config.fields.temporal_coverage = Settings.FIELDS.TEMPORAL_COVERAGE
|
|
88
|
-
config.fields.title = Settings.FIELDS.TITLE
|
|
89
|
-
config.fields.version = Settings.FIELDS.VERSION
|
|
90
|
-
config.fields.wxs_identifier = Settings.FIELDS.WXS_IDENTIFIER
|
|
91
|
-
end
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
end
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "spec_helper"
|
|
4
|
-
|
|
5
|
-
RSpec.feature "Display sidebar static map on catalog#show page" do
|
|
6
|
-
scenario "Document viewer protocol: IIIF (show)" do
|
|
7
|
-
visit solr_document_path "princeton-02870w62c"
|
|
8
|
-
within ".page-sidebar" do
|
|
9
|
-
expect(page).to have_content "Location"
|
|
10
|
-
expect(page).to have_css "div#static-map"
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
scenario "Document viewer protocol: WMS (do not show)" do
|
|
15
|
-
visit solr_document_path "stanford-cg357zz0321"
|
|
16
|
-
within ".page-sidebar" do
|
|
17
|
-
expect(page).to have_no_content "Location"
|
|
18
|
-
expect(page).to have_no_css "div#static-map"
|
|
19
|
-
end
|
|
20
|
-
end
|
|
21
|
-
end
|