geoblacklight 6.0.0.pre.alpha.2 → 6.0.0.pre.alpha.4
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 -1
- data/app/assets/stylesheets/geoblacklight/global.css +30 -0
- data/app/assets/stylesheets/geoblacklight/record.css +4 -0
- data/app/components/blacklight/icons/arrow_circle_down_component.rb +1 -1
- data/app/components/blacklight/icons/book_component.rb +1 -1
- data/app/components/blacklight/icons/cd_rom_component.rb +1 -1
- data/app/components/blacklight/icons/child_item_component.rb +1 -1
- data/app/components/blacklight/icons/citation_component.rb +1 -1
- data/app/components/blacklight/icons/collection_component.rb +1 -1
- data/app/components/blacklight/icons/collections_component.rb +1 -1
- data/app/components/blacklight/icons/datasets_component.rb +4 -4
- data/app/components/blacklight/icons/dvd_rom_component.rb +1 -1
- data/app/components/blacklight/icons/email_component.rb +1 -1
- data/app/components/blacklight/icons/fire_solid_component.rb +1 -1
- data/app/components/blacklight/icons/globe_component.rb +1 -1
- data/app/components/blacklight/icons/home_component.rb +1 -1
- data/app/components/blacklight/icons/image_component.rb +1 -1
- data/app/components/blacklight/icons/imagery_component.rb +1 -1
- data/app/components/blacklight/icons/leaf_component.rb +1 -1
- data/app/components/blacklight/icons/lightbulb_solid_component.rb +1 -1
- data/app/components/blacklight/icons/line_component.rb +2 -2
- data/app/components/blacklight/icons/map_component.rb +1 -1
- data/app/components/blacklight/icons/map_marker_component.rb +1 -1
- data/app/components/blacklight/icons/maps_component.rb +1 -1
- data/app/components/blacklight/icons/metadata_component.rb +1 -1
- data/app/components/blacklight/icons/mixed_component.rb +3 -3
- data/app/components/blacklight/icons/multilinestring_component.rb +4 -4
- data/app/components/blacklight/icons/multipoint_component.rb +1 -1
- data/app/components/blacklight/icons/multipolygon_component.rb +4 -4
- data/app/components/blacklight/icons/pagelines_brands_component.rb +1 -1
- data/app/components/blacklight/icons/paper_map_component.rb +1 -1
- data/app/components/blacklight/icons/parent_item_component.rb +1 -1
- data/app/components/blacklight/icons/point_component.rb +1 -1
- data/app/components/blacklight/icons/polygon_component.rb +2 -2
- data/app/components/blacklight/icons/polyline_component.rb +4 -4
- data/app/components/blacklight/icons/public_component.rb +1 -1
- data/app/components/blacklight/icons/raster_component.rb +1 -1
- data/app/components/blacklight/icons/restricted_component.rb +1 -1
- data/app/components/blacklight/icons/table_component.rb +1 -1
- data/app/components/blacklight/icons/tags_component.rb +1 -1
- data/app/components/blacklight/icons/triangle_exclamation_solid_component.rb +1 -1
- data/app/components/blacklight/icons/web_services_component.rb +1 -1
- data/app/components/blacklight/icons/websites_component.rb +1 -1
- data/app/components/geoblacklight/attribute_table_component.html.erb +1 -1
- data/app/components/geoblacklight/download_links_component.html.erb +1 -1
- data/app/components/geoblacklight/download_links_component.rb +4 -1
- data/app/components/geoblacklight/homepage_feature_facet_component.rb +1 -1
- data/app/components/geoblacklight/index_map_inspect_component.html.erb +8 -1
- data/app/components/geoblacklight/index_map_legend_component.html.erb +3 -3
- data/app/components/geoblacklight/location_leaflet_map_component.rb +8 -1
- data/app/components/geoblacklight/web_services_link_component.rb +1 -1
- data/app/helpers/geoblacklight_helper.rb +5 -2
- data/app/javascript/geoblacklight/controllers/downloads_controller.js +3 -3
- data/app/javascript/geoblacklight/initializers/truncation.js +5 -3
- data/app/javascript/geoblacklight/leaflet/controls/geosearch.js +4 -2
- data/app/javascript/geoblacklight/leaflet/inspection.js +10 -5
- data/app/javascript/geoblacklight/leaflet/layer_index_map.js +15 -12
- data/app/javascript/geoblacklight/leaflet/utils.js +8 -2
- data/app/javascript/geoblacklight/openlayers/inspection.js +3 -5
- data/app/views/catalog/metadata/_markup.html.erb +1 -1
- data/app/views/catalog/metadata.html.erb +1 -1
- data/config/locales/geoblacklight.en.yml +31 -0
- data/geoblacklight.gemspec +3 -4
- data/lib/generators/geoblacklight/install_generator.rb +0 -4
- data/lib/generators/geoblacklight/templates/settings.yml +286 -275
- data/lib/geoblacklight/configuration/leaflet_config.rb +22 -19
- data/lib/geoblacklight/configuration/leaflet_sleep_config.rb +1 -1
- data/lib/geoblacklight/engine.rb +1 -0
- data/lib/geoblacklight/metadata/base.rb +1 -1
- data/lib/geoblacklight/version.rb +1 -1
- data/lib/geoblacklight.rb +0 -1
- data/solr/conf/schema.xml +8 -7
- data/solr/conf/solrconfig.xml +1 -1
- data/spec/components/geoblacklight/download_links_component_spec.rb +4 -1
- data/spec/helpers/geoblacklight_helper_spec.rb +1 -1
- data/spec/lib/geoblacklight/configuration/leaflet_config_spec.rb +129 -0
- data/spec/lib/geoblacklight/configuration/settings_builder_spec.rb +110 -3
- data/spec/lib/geoblacklight/metadata/base_spec.rb +1 -1
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +1 -1
- metadata +15 -29
- data/lib/geoblacklight/faraday_middleware/follow_redirects.rb +0 -179
data/lib/geoblacklight.rb
CHANGED
data/solr/conf/schema.xml
CHANGED
|
@@ -66,15 +66,15 @@
|
|
|
66
66
|
<fieldType name="string" class="solr.StrField" sortMissingLast="true" />
|
|
67
67
|
<fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
|
|
68
68
|
|
|
69
|
-
<fieldType name="int" class="solr.
|
|
70
|
-
<fieldType name="float" class="solr.
|
|
71
|
-
<fieldType name="long" class="solr.
|
|
72
|
-
<fieldType name="double" class="solr.
|
|
69
|
+
<fieldType name="int" class="solr.IntPointField" docValues="true"/>
|
|
70
|
+
<fieldType name="float" class="solr.FloatPointField" docValues="true"/>
|
|
71
|
+
<fieldType name="long" class="solr.LongPointField" docValues="true"/>
|
|
72
|
+
<fieldType name="double" class="solr.DoublePointField" docValues="true"/>
|
|
73
73
|
|
|
74
74
|
<!-- The format for this date field is of the form 1995-12-31T23:59:59Z.
|
|
75
75
|
The trailing "Z" designates UTC time and is mandatory.
|
|
76
|
-
A
|
|
77
|
-
<fieldType name="date" class="solr.
|
|
76
|
+
A Point based date field for faster date range queries and date faceting. -->
|
|
77
|
+
<fieldType name="date" class="solr.DatePointField" docValues="true"/>
|
|
78
78
|
|
|
79
79
|
<!-- A DateRange based date field for truly faster date range queries. -->
|
|
80
80
|
<fieldType name="dateRange" class="solr.DateRangeField"/>
|
|
@@ -98,7 +98,8 @@
|
|
|
98
98
|
</analyzer>
|
|
99
99
|
<analyzer type="query">
|
|
100
100
|
<tokenizer class="solr.StandardTokenizerFactory"/>
|
|
101
|
-
<filter class="solr.
|
|
101
|
+
<filter class="solr.SynonymGraphFilterFactory" synonyms="synonyms.txt" ignoreCase="true" expand="true"/>
|
|
102
|
+
<filter class="solr.FlattenGraphFilterFactory"/>
|
|
102
103
|
<filter class="solr.StopFilterFactory" ignoreCase="true" words="stopwords_en.txt"/>
|
|
103
104
|
<filter class="solr.LowerCaseFilterFactory"/>
|
|
104
105
|
<filter class="solr.EnglishPossessiveFilterFactory"/>
|
data/solr/conf/solrconfig.xml
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
that you fully re-index after changing this setting as it can
|
|
28
28
|
affect both how text is indexed and queried.
|
|
29
29
|
-->
|
|
30
|
-
<luceneMatchVersion>
|
|
30
|
+
<luceneMatchVersion>9.0</luceneMatchVersion>
|
|
31
31
|
|
|
32
32
|
<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lib" />
|
|
33
33
|
<lib dir="${solr.install.dir:../../../..}/contrib/analysis-extras/lucene-libs" />
|
|
@@ -114,8 +114,11 @@ RSpec.describe Geoblacklight::DownloadLinksComponent, type: :component do
|
|
|
114
114
|
allow(component).to receive(:t).with("geoblacklight.download.export_shapefile_link").and_return("Shapefile Export Customization")
|
|
115
115
|
allow(component).to receive(:t).with("geoblacklight.download.export_link",
|
|
116
116
|
{download_format: "Shapefile Export Customization"}).and_return("Export Shapefile Export Customization")
|
|
117
|
+
allow(component).to receive(:t).with("geoblacklight.download.preparing").and_return("Preparing download...")
|
|
118
|
+
allow(component).to receive(:t).with("geoblacklight.download.ready", {type: "SHAPEFILE"}).and_return("Download ready (SHAPEFILE)")
|
|
119
|
+
allow(component).to receive(:t).with("geoblacklight.download.failed", {type: "SHAPEFILE"}).and_return("Download failed (SHAPEFILE)")
|
|
117
120
|
expect(component.download_link_generated(download_type,
|
|
118
|
-
document)).to eq '<a data-download-path="/download/test-id?type=SHAPEFILE" data-download="trigger" data-action="downloads#download:once" data-download-type="SHAPEFILE" data-download-id="test-id" href="">Export Shapefile Export Customization</a>'
|
|
121
|
+
document)).to eq '<a data-download-path="/download/test-id?type=SHAPEFILE" data-download="trigger" data-action="downloads#download:once" data-download-type="SHAPEFILE" data-download-id="test-id" data-download-preparing-message="Preparing download..." data-download-ready-message="Download ready (SHAPEFILE)" data-download-failed-message="Download failed (SHAPEFILE)" href="">Export Shapefile Export Customization</a>'
|
|
119
122
|
end
|
|
120
123
|
end
|
|
121
124
|
end
|
|
@@ -87,7 +87,7 @@ RSpec.describe GeoblacklightHelper, type: :helper do
|
|
|
87
87
|
context "with multiple values" do
|
|
88
88
|
let(:document) { SolrDocument.new(value: %w[short description]) }
|
|
89
89
|
it "wraps in correct DIV class" do
|
|
90
|
-
expect(helper.render_value_as_truncate_abstract(document)).to eq '<div class="truncate-abstract">short
|
|
90
|
+
expect(helper.render_value_as_truncate_abstract(document)).to eq '<div class="truncate-abstract" data-read-more-text="Read more" data-close-text="Close"><p>short</p><p>description</p></div>'
|
|
91
91
|
end
|
|
92
92
|
end
|
|
93
93
|
end
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "spec_helper"
|
|
4
|
+
|
|
5
|
+
RSpec.describe Geoblacklight::Configuration::LeafletConfig do
|
|
6
|
+
subject(:config) { described_class.new }
|
|
7
|
+
|
|
8
|
+
describe "#sleep=" do
|
|
9
|
+
it "replaces the default sleep config with a LeafletSleepConfig" do
|
|
10
|
+
config.sleep = {sleep: false, margin_distance: 50, message: "Wake up!"}
|
|
11
|
+
|
|
12
|
+
expect(config.sleep).to be_a(Geoblacklight::Configuration::LeafletSleepConfig)
|
|
13
|
+
expect(config.sleep.sleep).to be(false)
|
|
14
|
+
expect(config.sleep.margin_distance).to eq(50)
|
|
15
|
+
expect(config.sleep.message).to eq("Wake up!")
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
it "applies LeafletSleepConfig defaults for unspecified attributes" do
|
|
19
|
+
config.sleep = {message: "Custom message"}
|
|
20
|
+
|
|
21
|
+
expect(config.sleep.message).to eq("Custom message")
|
|
22
|
+
expect(config.sleep.sleep).to be(true)
|
|
23
|
+
expect(config.sleep.sleeptime).to eq(750)
|
|
24
|
+
expect(config.sleep.waketime).to eq(750)
|
|
25
|
+
expect(config.sleep.background).to eq("rgba(214, 214, 214, .7)")
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
it "replaces rather than merges with the previous sleep config" do
|
|
29
|
+
config.sleep = {sleep: false}
|
|
30
|
+
|
|
31
|
+
expect(config.sleep.sleep).to be(false)
|
|
32
|
+
expect(config.sleep.margin_distance).to eq(100)
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it "produces a fresh independent object on each assignment" do
|
|
36
|
+
original = config.sleep
|
|
37
|
+
config.sleep = {sleep: false}
|
|
38
|
+
|
|
39
|
+
expect(config.sleep).not_to be(original)
|
|
40
|
+
expect(original.sleep).to be(true)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "accepts an empty hash, falling back entirely to defaults" do
|
|
44
|
+
config.sleep = {}
|
|
45
|
+
|
|
46
|
+
expect(config.sleep).to be_a(Geoblacklight::Configuration::LeafletSleepConfig)
|
|
47
|
+
expect(config.sleep.sleep).to be(true)
|
|
48
|
+
expect(config.sleep.message).to eq("Click to Wake")
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it "is reflected in #to_h" do
|
|
52
|
+
config.sleep = {sleep: false, message: "Hello"}
|
|
53
|
+
|
|
54
|
+
expect(config.to_h[:sleep]).to include("sleep" => false, "message" => "Hello")
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
describe "#layers=" do
|
|
59
|
+
let(:attributes) do
|
|
60
|
+
{
|
|
61
|
+
detect_retina: false,
|
|
62
|
+
index: {
|
|
63
|
+
DEFAULT: {color: "#7FCDBB", sr_color_name: "Green"},
|
|
64
|
+
UNAVAILABLE: Geoblacklight::Configuration::LayerConfig.new(
|
|
65
|
+
color: "#EDF8B1", sr_color_name: "Yellow"
|
|
66
|
+
)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
it "replaces the default layers config with a LeafletLayersConfig" do
|
|
72
|
+
config.layers = attributes
|
|
73
|
+
|
|
74
|
+
expect(config.layers).to be_a(Geoblacklight::Configuration::LeafletLayersConfig)
|
|
75
|
+
expect(config.layers.detect_retina).to be(false)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it "coerces hash entries under index into LayerConfig instances" do
|
|
79
|
+
config.layers = attributes
|
|
80
|
+
|
|
81
|
+
default = config.layers.index[:DEFAULT]
|
|
82
|
+
expect(default).to be_a(Geoblacklight::Configuration::LayerConfig)
|
|
83
|
+
expect(default.color).to eq("#7FCDBB")
|
|
84
|
+
expect(default.sr_color_name).to eq("Green")
|
|
85
|
+
expect(default.weight).to eq(1)
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it "preserves existing LayerConfig instances under index" do
|
|
89
|
+
config.layers = attributes
|
|
90
|
+
|
|
91
|
+
unavailable = config.layers.index[:UNAVAILABLE]
|
|
92
|
+
expect(unavailable).to be_a(Geoblacklight::Configuration::LayerConfig)
|
|
93
|
+
expect(unavailable.color).to eq("#EDF8B1")
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
it "replaces rather than merges with the previous layers config" do
|
|
97
|
+
config.layers = {index: {DEFAULT: {color: "#000000"}}}
|
|
98
|
+
|
|
99
|
+
expect(config.layers.index.keys).to eq([:DEFAULT])
|
|
100
|
+
expect(config.layers.index[:SELECTED]).to be_nil
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
it "produces a fresh independent object on each assignment" do
|
|
104
|
+
original = config.layers
|
|
105
|
+
config.layers = {index: {}}
|
|
106
|
+
|
|
107
|
+
expect(config.layers).not_to be(original)
|
|
108
|
+
expect(original.index).to include(:DEFAULT, :UNAVAILABLE, :SELECTED)
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it "accepts an empty hash, resulting in an empty index" do
|
|
112
|
+
config.layers = {}
|
|
113
|
+
|
|
114
|
+
expect(config.layers).to be_a(Geoblacklight::Configuration::LeafletLayersConfig)
|
|
115
|
+
expect(config.layers.index).to eq({})
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
it "is reflected in #to_h" do
|
|
119
|
+
config.layers = attributes
|
|
120
|
+
|
|
121
|
+
expect(config.to_h[:layers]).to include(
|
|
122
|
+
"detect_retina" => false,
|
|
123
|
+
"index" => hash_including(
|
|
124
|
+
DEFAULT: {color: "#7FCDBB", weight: 1, radius: 4, sr_color_name: "Green"}
|
|
125
|
+
)
|
|
126
|
+
)
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
end
|
|
@@ -2,12 +2,13 @@ require "spec_helper"
|
|
|
2
2
|
|
|
3
3
|
RSpec.describe Geoblacklight::Configuration::SettingsBuilder do
|
|
4
4
|
describe ".build" do
|
|
5
|
+
before {
|
|
6
|
+
Settings.institution = "MIT"
|
|
7
|
+
}
|
|
5
8
|
subject(:config) { described_class.build }
|
|
6
9
|
|
|
7
|
-
it { is_expected.to be_a(Geoblacklight::Configuration) }
|
|
8
|
-
|
|
9
10
|
it "reads values from the real Settings (lowercase) constant" do
|
|
10
|
-
expect(config.institution).to eq(
|
|
11
|
+
expect(config.institution).to eq("MIT")
|
|
11
12
|
end
|
|
12
13
|
end
|
|
13
14
|
|
|
@@ -89,6 +90,112 @@ RSpec.describe Geoblacklight::Configuration::SettingsBuilder do
|
|
|
89
90
|
expect(config.institution).to eq("Stanford")
|
|
90
91
|
end
|
|
91
92
|
end
|
|
93
|
+
|
|
94
|
+
describe "display_notes_shown" do
|
|
95
|
+
it "preserves the defaults when DISPLAY_NOTES_SHOWN is absent" do
|
|
96
|
+
expect(described_class.new(settings: {}).build.display_notes_shown).to(
|
|
97
|
+
include(:danger, :info, :tip, :warning)
|
|
98
|
+
)
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it "builds DisplayNoteShownConfig objects from a lowercase hash" do
|
|
102
|
+
settings = {
|
|
103
|
+
display_notes_shown: {
|
|
104
|
+
danger: {
|
|
105
|
+
bootstrap_alert_class: "alert-danger",
|
|
106
|
+
icon: "fire-solid",
|
|
107
|
+
note_prefix: "Danger: "
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
result = described_class.new(settings: settings).build.display_notes_shown
|
|
113
|
+
|
|
114
|
+
expect(result.keys).to eq([:danger])
|
|
115
|
+
danger = result[:danger]
|
|
116
|
+
expect(danger).to be_a(Geoblacklight::Configuration::DisplayNoteShownConfig)
|
|
117
|
+
expect(danger.bootstrap_alert_class).to eq("alert-danger")
|
|
118
|
+
expect(danger.icon).to eq("fire-solid")
|
|
119
|
+
expect(danger.note_prefix).to eq("Danger: ")
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
it "builds each entry as a DisplayNoteShownConfig when multiple are given" do
|
|
123
|
+
settings = {
|
|
124
|
+
display_notes_shown: {
|
|
125
|
+
info: {bootstrap_alert_class: "alert-info", icon: "circle-info-solid", note_prefix: "Info: "},
|
|
126
|
+
tip: {bootstrap_alert_class: "alert-success", icon: "lightbulb-solid", note_prefix: "Tip: "}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
result = described_class.new(settings: settings).build.display_notes_shown
|
|
131
|
+
|
|
132
|
+
expect(result.keys).to contain_exactly(:info, :tip)
|
|
133
|
+
expect(result.values).to all(be_a(Geoblacklight::Configuration::DisplayNoteShownConfig))
|
|
134
|
+
expect(result[:tip].note_prefix).to eq("Tip: ")
|
|
135
|
+
end
|
|
136
|
+
|
|
137
|
+
it "coerces non-hash values into hashes before constructing the config" do
|
|
138
|
+
struct = Struct.new(:bootstrap_alert_class, :icon, :note_prefix)
|
|
139
|
+
note = struct.new("alert-warning", "triangle-exclamation-solid", "Warning: ")
|
|
140
|
+
|
|
141
|
+
settings = {display_notes_shown: {warning: note}}
|
|
142
|
+
|
|
143
|
+
result = described_class.new(settings: settings).build.display_notes_shown[:warning]
|
|
144
|
+
|
|
145
|
+
expect(result).to be_a(Geoblacklight::Configuration::DisplayNoteShownConfig)
|
|
146
|
+
expect(result.bootstrap_alert_class).to eq("alert-warning")
|
|
147
|
+
expect(result.icon).to eq("triangle-exclamation-solid")
|
|
148
|
+
expect(result.note_prefix).to eq("Warning: ")
|
|
149
|
+
end
|
|
150
|
+
|
|
151
|
+
it "supports partially-specified notes by leaving unset attributes blank" do
|
|
152
|
+
settings = {display_notes_shown: {custom: {icon: "star-solid"}}}
|
|
153
|
+
|
|
154
|
+
result = described_class.new(settings: settings).build.display_notes_shown[:custom]
|
|
155
|
+
|
|
156
|
+
expect(result).to be_a(Geoblacklight::Configuration::DisplayNoteShownConfig)
|
|
157
|
+
expect(result.icon).to eq("star-solid")
|
|
158
|
+
expect(result.bootstrap_alert_class).to be_nil
|
|
159
|
+
expect(result.note_prefix).to be_nil
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
it "replaces the defaults entirely rather than merging" do
|
|
163
|
+
settings = {display_notes_shown: {custom: {icon: "star-solid"}}}
|
|
164
|
+
|
|
165
|
+
result = described_class.new(settings: settings).build.display_notes_shown
|
|
166
|
+
|
|
167
|
+
expect(result.keys).to eq([:custom])
|
|
168
|
+
expect(result).not_to include(:danger, :info, :tip, :warning)
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
it "handles an empty display_notes_shown hash" do
|
|
172
|
+
settings = {display_notes_shown: {}}
|
|
173
|
+
|
|
174
|
+
expect(described_class.new(settings: settings).build.display_notes_shown).to eq({})
|
|
175
|
+
end
|
|
176
|
+
|
|
177
|
+
it "resolves an uppercase DISPLAY_NOTES_SHOWN key for backwards compatibility" do
|
|
178
|
+
allow(Geoblacklight::Deprecation).to receive(:warn)
|
|
179
|
+
|
|
180
|
+
settings = {
|
|
181
|
+
DISPLAY_NOTES_SHOWN: {
|
|
182
|
+
danger: {
|
|
183
|
+
bootstrap_alert_class: "alert-danger",
|
|
184
|
+
icon: "fire-solid",
|
|
185
|
+
note_prefix: "Danger: "
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
result = described_class.new(settings: settings).build.display_notes_shown[:danger]
|
|
191
|
+
|
|
192
|
+
expect(result).to be_a(Geoblacklight::Configuration::DisplayNoteShownConfig)
|
|
193
|
+
expect(result.bootstrap_alert_class).to eq("alert-danger")
|
|
194
|
+
expect(result.icon).to eq("fire-solid")
|
|
195
|
+
expect(result.note_prefix).to eq("Danger: ")
|
|
196
|
+
expect(Geoblacklight::Deprecation).to have_received(:warn).with(a_string_matching(/DISPLAY_NOTES_SHOWN/i))
|
|
197
|
+
end
|
|
198
|
+
end
|
|
92
199
|
end
|
|
93
200
|
end
|
|
94
201
|
|
|
@@ -130,7 +130,7 @@ RSpec.describe Geoblacklight::Metadata::Base do
|
|
|
130
130
|
before do
|
|
131
131
|
allow(GeoCombine::Metadata).to receive(:new).and_return(geocombine_metadata)
|
|
132
132
|
|
|
133
|
-
allow(connection).to receive(:
|
|
133
|
+
allow(connection).to receive(:response)
|
|
134
134
|
allow(connection).to receive(:adapter)
|
|
135
135
|
allow(Faraday).to receive(:new).and_yield(connection).and_return(connection)
|
|
136
136
|
|
|
@@ -16,7 +16,7 @@ class TestAppGenerator < Rails::Generators::Base
|
|
|
16
16
|
# Install blacklight
|
|
17
17
|
def run_blacklight_generator
|
|
18
18
|
say_status("warning", "GENERATING BL", :yellow)
|
|
19
|
-
generate "blacklight:install", "--devise"
|
|
19
|
+
generate "blacklight:install", "--devise"
|
|
20
20
|
end
|
|
21
21
|
|
|
22
22
|
# Install geoblacklight
|
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.4
|
|
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-
|
|
13
|
+
date: 2026-07-08 00:00:00.000000000 Z
|
|
14
14
|
dependencies:
|
|
15
15
|
- !ruby/object:Gem::Dependency
|
|
16
16
|
name: rails
|
|
@@ -18,7 +18,7 @@ dependencies:
|
|
|
18
18
|
requirements:
|
|
19
19
|
- - ">="
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: '
|
|
21
|
+
version: '8'
|
|
22
22
|
- - "<"
|
|
23
23
|
- !ruby/object:Gem::Version
|
|
24
24
|
version: '9'
|
|
@@ -28,7 +28,7 @@ dependencies:
|
|
|
28
28
|
requirements:
|
|
29
29
|
- - ">="
|
|
30
30
|
- !ruby/object:Gem::Version
|
|
31
|
-
version: '
|
|
31
|
+
version: '8'
|
|
32
32
|
- - "<"
|
|
33
33
|
- !ruby/object:Gem::Version
|
|
34
34
|
version: '9'
|
|
@@ -81,7 +81,7 @@ dependencies:
|
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
82
|
version: '2.0'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
84
|
+
name: faraday-follow_redirects
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
|
86
86
|
requirements:
|
|
87
87
|
- - ">="
|
|
@@ -95,7 +95,7 @@ dependencies:
|
|
|
95
95
|
- !ruby/object:Gem::Version
|
|
96
96
|
version: '0'
|
|
97
97
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
98
|
+
name: coderay
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
101
|
- - ">="
|
|
@@ -109,21 +109,7 @@ dependencies:
|
|
|
109
109
|
- !ruby/object:Gem::Version
|
|
110
110
|
version: '0'
|
|
111
111
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
113
|
-
requirement: !ruby/object:Gem::Requirement
|
|
114
|
-
requirements:
|
|
115
|
-
- - "~>"
|
|
116
|
-
- !ruby/object:Gem::Version
|
|
117
|
-
version: '0.9'
|
|
118
|
-
type: :runtime
|
|
119
|
-
prerelease: false
|
|
120
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
-
requirements:
|
|
122
|
-
- - "~>"
|
|
123
|
-
- !ruby/object:Gem::Version
|
|
124
|
-
version: '0.9'
|
|
125
|
-
- !ruby/object:Gem::Dependency
|
|
126
|
-
name: mime-types
|
|
112
|
+
name: deprecation
|
|
127
113
|
requirement: !ruby/object:Gem::Requirement
|
|
128
114
|
requirements:
|
|
129
115
|
- - ">="
|
|
@@ -137,21 +123,21 @@ dependencies:
|
|
|
137
123
|
- !ruby/object:Gem::Version
|
|
138
124
|
version: '0'
|
|
139
125
|
- !ruby/object:Gem::Dependency
|
|
140
|
-
name:
|
|
126
|
+
name: geo_combine
|
|
141
127
|
requirement: !ruby/object:Gem::Requirement
|
|
142
128
|
requirements:
|
|
143
|
-
- - "
|
|
129
|
+
- - "~>"
|
|
144
130
|
- !ruby/object:Gem::Version
|
|
145
|
-
version: '0'
|
|
131
|
+
version: '0.10'
|
|
146
132
|
type: :runtime
|
|
147
133
|
prerelease: false
|
|
148
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
149
135
|
requirements:
|
|
150
|
-
- - "
|
|
136
|
+
- - "~>"
|
|
151
137
|
- !ruby/object:Gem::Version
|
|
152
|
-
version: '0'
|
|
138
|
+
version: '0.10'
|
|
153
139
|
- !ruby/object:Gem::Dependency
|
|
154
|
-
name:
|
|
140
|
+
name: mime-types
|
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
|
156
142
|
requirements:
|
|
157
143
|
- - ">="
|
|
@@ -165,7 +151,7 @@ dependencies:
|
|
|
165
151
|
- !ruby/object:Gem::Version
|
|
166
152
|
version: '0'
|
|
167
153
|
- !ruby/object:Gem::Dependency
|
|
168
|
-
name:
|
|
154
|
+
name: rgeo-geojson
|
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
|
170
156
|
requirements:
|
|
171
157
|
- - ">="
|
|
@@ -564,7 +550,6 @@ files:
|
|
|
564
550
|
- lib/geoblacklight/download/shapefile_download.rb
|
|
565
551
|
- lib/geoblacklight/engine.rb
|
|
566
552
|
- lib/geoblacklight/exceptions.rb
|
|
567
|
-
- lib/geoblacklight/faraday_middleware/follow_redirects.rb
|
|
568
553
|
- lib/geoblacklight/geometry.rb
|
|
569
554
|
- lib/geoblacklight/item_viewer.rb
|
|
570
555
|
- lib/geoblacklight/metadata.rb
|
|
@@ -747,6 +732,7 @@ files:
|
|
|
747
732
|
- spec/lib/geoblacklight/bounding_box_spec.rb
|
|
748
733
|
- spec/lib/geoblacklight/configuration/default_settings_builder_spec.rb
|
|
749
734
|
- spec/lib/geoblacklight/configuration/layer_config_spec.rb
|
|
735
|
+
- spec/lib/geoblacklight/configuration/leaflet_config_spec.rb
|
|
750
736
|
- spec/lib/geoblacklight/configuration/leaflet_layers_config_spec.rb
|
|
751
737
|
- spec/lib/geoblacklight/configuration/settings_builder_spec.rb
|
|
752
738
|
- spec/lib/geoblacklight/configuration_spec.rb
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# :nocov:
|
|
4
|
-
# standard:disable Lint/RedundantRequireStatement
|
|
5
|
-
require "faraday"
|
|
6
|
-
require "set"
|
|
7
|
-
# standard:enable Lint/RedundantRequireStatement
|
|
8
|
-
|
|
9
|
-
module Geoblacklight
|
|
10
|
-
# NOTE: We copied this class from faraday_middleware in order to support
|
|
11
|
-
# both Faraday 1 & 2. If this middleware is ever extracted from
|
|
12
|
-
# faraday_middleware into its own gem we should remove this and use that
|
|
13
|
-
# instead.
|
|
14
|
-
module FaradayMiddleware
|
|
15
|
-
# Exception thrown when the maximum amount of requests is
|
|
16
|
-
# exceeded.
|
|
17
|
-
class RedirectLimitReached < ::Faraday::ClientError
|
|
18
|
-
attr_reader :response
|
|
19
|
-
|
|
20
|
-
def initialize(response)
|
|
21
|
-
super("too many redirects; last one to: #{response["location"]}")
|
|
22
|
-
@response = response
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
# Public: Follow HTTP 301, 302, 303, 307, and 308 redirects.
|
|
27
|
-
#
|
|
28
|
-
# For HTTP 301, 302, and 303, the original GET, POST, PUT, DELETE, or PATCH
|
|
29
|
-
# request gets converted into a GET. With `:standards_compliant => true`,
|
|
30
|
-
# however, the HTTP method after 301/302 remains unchanged. This allows you
|
|
31
|
-
# to opt into HTTP/1.1 compliance and act unlike the major web browsers.
|
|
32
|
-
#
|
|
33
|
-
# This middleware currently only works with synchronous requests; i.e. it
|
|
34
|
-
# doesn't support parallelism.
|
|
35
|
-
#
|
|
36
|
-
# If you wish to persist cookies across redirects, you could use
|
|
37
|
-
# the faraday-cookie_jar gem:
|
|
38
|
-
#
|
|
39
|
-
# Faraday.new(:url => url) do |faraday|
|
|
40
|
-
# faraday.use FaradayMiddleware::FollowRedirects
|
|
41
|
-
# faraday.use :cookie_jar
|
|
42
|
-
# faraday.adapter Faraday.default_adapter
|
|
43
|
-
# end
|
|
44
|
-
#
|
|
45
|
-
class FollowRedirects < ::Faraday::Middleware
|
|
46
|
-
# HTTP methods for which 30x redirects can be followed
|
|
47
|
-
ALLOWED_METHODS = Set.new [:head, :options, :get, :post, :put, :patch, :delete]
|
|
48
|
-
# HTTP redirect status codes that this middleware implements
|
|
49
|
-
REDIRECT_CODES = Set.new [301, 302, 303, 307, 308]
|
|
50
|
-
# Keys in env hash which will get cleared between requests
|
|
51
|
-
ENV_TO_CLEAR = Set.new [:status, :response, :response_headers]
|
|
52
|
-
|
|
53
|
-
# Default value for max redirects followed
|
|
54
|
-
FOLLOW_LIMIT = 3
|
|
55
|
-
|
|
56
|
-
# Regex that matches characters that need to be escaped in URLs, sans
|
|
57
|
-
# the "%" character which we assume already represents an escaped sequence.
|
|
58
|
-
URI_UNSAFE = %r{[^\-_.!~*'()a-zA-Z\d;/?:@&=+$,\[\]%]}
|
|
59
|
-
|
|
60
|
-
AUTH_HEADER = "Authorization"
|
|
61
|
-
|
|
62
|
-
# Public: Initialize the middleware.
|
|
63
|
-
#
|
|
64
|
-
# options - An options Hash (default: {}):
|
|
65
|
-
# :limit - A Numeric redirect limit (default: 3)
|
|
66
|
-
# :standards_compliant - A Boolean indicating whether to respect
|
|
67
|
-
# the HTTP spec when following 301/302
|
|
68
|
-
# (default: false)
|
|
69
|
-
# :callback - A callable used on redirects
|
|
70
|
-
# with the old and new envs
|
|
71
|
-
# :cookies - An Array of Strings (e.g.
|
|
72
|
-
# ['cookie1', 'cookie2']) to choose
|
|
73
|
-
# cookies to be kept, or :all to keep
|
|
74
|
-
# all cookies (default: []).
|
|
75
|
-
# :clear_authorization_header - A Boolean indicating whether the request
|
|
76
|
-
# Authorization header should be cleared on
|
|
77
|
-
# redirects (default: true)
|
|
78
|
-
def initialize(app, options = {})
|
|
79
|
-
super(app)
|
|
80
|
-
@options = options
|
|
81
|
-
|
|
82
|
-
@convert_to_get = Set.new [303]
|
|
83
|
-
@convert_to_get << 301 << 302 unless standards_compliant?
|
|
84
|
-
end
|
|
85
|
-
|
|
86
|
-
def call(env)
|
|
87
|
-
perform_with_redirection(env, follow_limit)
|
|
88
|
-
end
|
|
89
|
-
|
|
90
|
-
private
|
|
91
|
-
|
|
92
|
-
def convert_to_get?(response)
|
|
93
|
-
[:head, :options].exclude?(response.env[:method]) &&
|
|
94
|
-
@convert_to_get.include?(response.status)
|
|
95
|
-
end
|
|
96
|
-
|
|
97
|
-
def perform_with_redirection(env, follows)
|
|
98
|
-
request_body = env[:body]
|
|
99
|
-
response = @app.call(env)
|
|
100
|
-
|
|
101
|
-
response.on_complete do |response_env|
|
|
102
|
-
if follow_redirect?(response_env, response)
|
|
103
|
-
fail RedirectLimitReached, response if follows.zero?
|
|
104
|
-
|
|
105
|
-
new_request_env = update_env(response_env.dup, request_body, response)
|
|
106
|
-
callback&.call(response_env, new_request_env)
|
|
107
|
-
response = perform_with_redirection(new_request_env, follows - 1)
|
|
108
|
-
end
|
|
109
|
-
end
|
|
110
|
-
response
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
def update_env(env, request_body, response)
|
|
114
|
-
redirect_from_url = env[:url].to_s
|
|
115
|
-
redirect_to_url = safe_escape(response["location"] || "")
|
|
116
|
-
env[:url] += redirect_to_url
|
|
117
|
-
|
|
118
|
-
ENV_TO_CLEAR.each { |key| env.delete key }
|
|
119
|
-
|
|
120
|
-
if convert_to_get?(response)
|
|
121
|
-
env[:method] = :get
|
|
122
|
-
env[:body] = nil
|
|
123
|
-
else
|
|
124
|
-
env[:body] = request_body
|
|
125
|
-
end
|
|
126
|
-
|
|
127
|
-
clear_authorization_header(env, redirect_from_url, redirect_to_url)
|
|
128
|
-
|
|
129
|
-
env
|
|
130
|
-
end
|
|
131
|
-
|
|
132
|
-
def follow_redirect?(env, response)
|
|
133
|
-
ALLOWED_METHODS.include?(env[:method]) &&
|
|
134
|
-
REDIRECT_CODES.include?(response.status)
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
def follow_limit
|
|
138
|
-
@options.fetch(:limit, FOLLOW_LIMIT)
|
|
139
|
-
end
|
|
140
|
-
|
|
141
|
-
def standards_compliant?
|
|
142
|
-
@options.fetch(:standards_compliant, false)
|
|
143
|
-
end
|
|
144
|
-
|
|
145
|
-
def callback
|
|
146
|
-
@options[:callback]
|
|
147
|
-
end
|
|
148
|
-
|
|
149
|
-
# Internal: escapes unsafe characters from an URL which might be a path
|
|
150
|
-
# component only or a fully qualified URI so that it can be joined onto an
|
|
151
|
-
# URI:HTTP using the `+` operator. Doesn't escape "%" characters so to not
|
|
152
|
-
# risk double-escaping.
|
|
153
|
-
def safe_escape(uri)
|
|
154
|
-
uri = uri.split("#")[0] # we want to remove the fragment if present
|
|
155
|
-
uri.to_s.gsub(URI_UNSAFE) do |match|
|
|
156
|
-
"%#{match.unpack("H2" * match.bytesize).join("%").upcase}"
|
|
157
|
-
end
|
|
158
|
-
end
|
|
159
|
-
|
|
160
|
-
def clear_authorization_header(env, from_url, to_url)
|
|
161
|
-
return env if redirect_to_same_host?(from_url, to_url)
|
|
162
|
-
return env unless @options.fetch(:clear_authorization_header, true)
|
|
163
|
-
|
|
164
|
-
env[:request_headers].delete(AUTH_HEADER)
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
def redirect_to_same_host?(from_url, to_url)
|
|
168
|
-
return true if to_url.start_with?("/")
|
|
169
|
-
|
|
170
|
-
from_uri = URI.parse(from_url)
|
|
171
|
-
to_uri = URI.parse(to_url)
|
|
172
|
-
|
|
173
|
-
[from_uri.scheme, from_uri.host, from_uri.port] ==
|
|
174
|
-
[to_uri.scheme, to_uri.host, to_uri.port]
|
|
175
|
-
end
|
|
176
|
-
end
|
|
177
|
-
end
|
|
178
|
-
end
|
|
179
|
-
# :nocov:
|