geoblacklight 6.0.0.pre.alpha.3 → 6.0.0.pre.alpha.5
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/Rakefile +0 -1
- data/app/assets/stylesheets/geoblacklight/global.css +30 -0
- data/app/assets/stylesheets/geoblacklight/record.css +41 -1
- data/app/components/geoblacklight/document/download_link_component.html.erb +6 -0
- data/app/components/geoblacklight/document/download_link_component.rb +66 -0
- data/app/components/geoblacklight/document/download_links_component.html.erb +8 -0
- data/app/components/geoblacklight/document/download_links_component.rb +59 -0
- data/app/components/geoblacklight/document/sidebar_component.html.erb +3 -9
- data/app/components/geoblacklight/document/sidebar_component.rb +6 -11
- data/app/components/geoblacklight/login_link_component.html.erb +3 -5
- data/app/helpers/geoblacklight_helper.rb +1 -1
- data/app/javascript/geoblacklight/core.js +0 -2
- data/app/javascript/geoblacklight/index.js +0 -2
- data/app/javascript/geoblacklight/leaflet/inspection.js +5 -4
- data/app/models/concerns/geoblacklight/solr_document.rb +1 -2
- data/config/locales/geoblacklight.en.yml +5 -14
- data/geoblacklight.gemspec +0 -1
- data/lib/generators/geoblacklight/install_generator.rb +0 -9
- data/lib/generators/geoblacklight/templates/settings.yml +1 -15
- data/lib/geoblacklight/configuration/settings_builder.rb +0 -3
- data/lib/geoblacklight/configuration.rb +0 -10
- data/lib/geoblacklight/exceptions.rb +0 -23
- data/lib/geoblacklight/references.rb +0 -80
- data/lib/geoblacklight/version.rb +1 -1
- data/lib/geoblacklight.rb +0 -1
- data/lib/tasks/geoblacklight.rake +0 -30
- data/spec/components/geoblacklight/document/sidebar_component_spec.rb +1 -1
- data/spec/components/geoblacklight/download_links_component_spec.rb +59 -85
- data/spec/features/index_view_spec.rb +0 -33
- data/spec/features/layer_inspection_spec.rb +0 -10
- data/spec/features/layer_opacity_spec.rb +0 -7
- data/spec/helpers/geoblacklight_helper_spec.rb +1 -1
- data/spec/lib/geoblacklight/configuration/settings_builder_spec.rb +0 -2
- data/spec/lib/geoblacklight/references_spec.rb +1 -57
- data/spec/models/concerns/geoblacklight/solr_document_spec.rb +0 -7
- data/template.rb +1 -1
- metadata +6 -42
- data/app/components/geoblacklight/download_links_component.html.erb +0 -31
- data/app/components/geoblacklight/download_links_component.rb +0 -87
- data/app/controllers/download_controller.rb +0 -76
- data/app/javascript/geoblacklight/controllers/downloads_controller.js +0 -64
- data/lib/geoblacklight/download/csv_download.rb +0 -22
- data/lib/geoblacklight/download/geojson_download.rb +0 -24
- data/lib/geoblacklight/download/geotiff_download.rb +0 -22
- data/lib/geoblacklight/download/kmz_download.rb +0 -24
- data/lib/geoblacklight/download/shapefile_download.rb +0 -22
- data/lib/geoblacklight/download.rb +0 -110
- data/lib/geoblacklight/routes/downloadable.rb +0 -15
- data/spec/controllers/download_controller_spec.rb +0 -99
- data/spec/features/download_layer_spec.rb +0 -96
- data/spec/features/esri_viewer_spec.rb +0 -43
- data/spec/features/index_map_spec.rb +0 -40
- data/spec/features/layer_with_no_references_spec.rb +0 -10
- data/spec/features/linkified_attribute_table_spec.rb +0 -13
- data/spec/features/multiple_downloads_spec.rb +0 -17
- data/spec/features/show_page_download_spec.rb +0 -22
- data/spec/lib/geoblacklight/download/csv_download_spec.rb +0 -21
- data/spec/lib/geoblacklight/download/geojson_download_spec.rb +0 -22
- data/spec/lib/geoblacklight/download/geotiff_download_spec.rb +0 -25
- data/spec/lib/geoblacklight/download/kmz_download_spec.rb +0 -22
- data/spec/lib/geoblacklight/download/shapefile_download_spec.rb +0 -21
- data/spec/lib/geoblacklight/download_spec.rb +0 -188
- data/spec/tasks/geoblacklight_spec.rb +0 -20
|
@@ -43,34 +43,6 @@ module Geoblacklight
|
|
|
43
43
|
@refs.find { |reference| reference.type == ref_type }
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
-
##
|
|
47
|
-
# Preferred download (should be a file download)
|
|
48
|
-
# @return [Hash, nil]
|
|
49
|
-
def preferred_download
|
|
50
|
-
file_download if download.present?
|
|
51
|
-
end
|
|
52
|
-
|
|
53
|
-
##
|
|
54
|
-
# Download hash based off of format type
|
|
55
|
-
# @return [Hash, nil]
|
|
56
|
-
def downloads_by_format
|
|
57
|
-
case format
|
|
58
|
-
when "Shapefile"
|
|
59
|
-
vector_download_formats
|
|
60
|
-
when "GeoTIFF"
|
|
61
|
-
geotiff_download_formats
|
|
62
|
-
when "ArcGRID"
|
|
63
|
-
arcgrid_download_formats
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
##
|
|
68
|
-
# Generated download types from wxs services
|
|
69
|
-
# @return (see #downloads_by_format)
|
|
70
|
-
def download_types
|
|
71
|
-
downloads_by_format
|
|
72
|
-
end
|
|
73
|
-
|
|
74
46
|
##
|
|
75
47
|
# Returns all of the Esri webservices for given set of references
|
|
76
48
|
def esri_webservices
|
|
@@ -92,58 +64,6 @@ module Geoblacklight
|
|
|
92
64
|
end
|
|
93
65
|
end
|
|
94
66
|
|
|
95
|
-
##
|
|
96
|
-
# Download hash for a static file download
|
|
97
|
-
# @return (see #downloads_by_format)
|
|
98
|
-
def file_download
|
|
99
|
-
{file_download: download.to_hash}
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
##
|
|
103
|
-
# Download hash for a Shapefile file (currently only vector) with a wms and wfs reference
|
|
104
|
-
# present
|
|
105
|
-
# @return (see #downloads_by_format)
|
|
106
|
-
def vector_download_formats
|
|
107
|
-
return unless wms.present? && wfs.present?
|
|
108
|
-
|
|
109
|
-
download_formats = {}
|
|
110
|
-
format_list.each { |format| download_formats.merge!(web_service_hash(format)) }
|
|
111
|
-
download_formats
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
def format_list
|
|
115
|
-
Geoblacklight.configuration.vector_download_formats || []
|
|
116
|
-
end
|
|
117
|
-
|
|
118
|
-
def web_service_hash(format)
|
|
119
|
-
case format
|
|
120
|
-
when "Shapefile"
|
|
121
|
-
{shapefile: wfs.to_hash}
|
|
122
|
-
when "KMZ"
|
|
123
|
-
{kmz: wms.to_hash}
|
|
124
|
-
when "GeoJSON"
|
|
125
|
-
{geojson: wfs.to_hash}
|
|
126
|
-
when "CSV"
|
|
127
|
-
{csv: wfs.to_hash}
|
|
128
|
-
else
|
|
129
|
-
{}
|
|
130
|
-
end
|
|
131
|
-
end
|
|
132
|
-
|
|
133
|
-
##
|
|
134
|
-
# Download hash for a GeoTiff file with a WMS reference present
|
|
135
|
-
# @return (see #downloads_by_format)
|
|
136
|
-
def geotiff_download_formats
|
|
137
|
-
{geotiff: wms.to_hash} if wms.present?
|
|
138
|
-
end
|
|
139
|
-
|
|
140
|
-
##
|
|
141
|
-
# Download hash for an ArcGRID file with a WMS reference present
|
|
142
|
-
# @return (see #downloads_by_format)
|
|
143
|
-
def arcgrid_download_formats
|
|
144
|
-
{geotiff: wms.to_hash} if wms.present?
|
|
145
|
-
end
|
|
146
|
-
|
|
147
67
|
##
|
|
148
68
|
# Adds a call to references for defined URI keys
|
|
149
69
|
def method_missing(m, *args, &b)
|
data/lib/geoblacklight.rb
CHANGED
|
@@ -51,36 +51,6 @@ namespace :geoblacklight do
|
|
|
51
51
|
end
|
|
52
52
|
end
|
|
53
53
|
|
|
54
|
-
namespace :downloads do
|
|
55
|
-
desc "Delete all cached downloads"
|
|
56
|
-
task delete: :environment do
|
|
57
|
-
FileUtils.rm_rf Dir.glob(Rails.root.join("tmp", "cache", "downloads", "*"))
|
|
58
|
-
end
|
|
59
|
-
desc "Create download directory"
|
|
60
|
-
task mkdir: :environment do
|
|
61
|
-
FileUtils.mkdir_p(Rails.root.join("tmp", "cache", "downloads"), verbose: true)
|
|
62
|
-
end
|
|
63
|
-
desc "Precaches a download"
|
|
64
|
-
task :precache, %i[doc_id download_type timeout] => [:environment] do |_t, args|
|
|
65
|
-
unless args[:doc_id] && args[:download_type] && args[:timeout]
|
|
66
|
-
raise "Please supply required arguments [document_id, download_type and timeout]"
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
document = Geoblacklight::SolrDocument.find(args[:doc_id])
|
|
70
|
-
raise Blacklight::Exceptions::RecordNotFound if document[:id] != args[:doc_id]
|
|
71
|
-
|
|
72
|
-
download = "Geoblacklight::#{args[:download_type].capitalize}Download"
|
|
73
|
-
.constantize.new(document, timeout: args[:timeout].to_i)
|
|
74
|
-
download.get
|
|
75
|
-
Rails.logger.info "Successfully downloaded #{download.file_name}"
|
|
76
|
-
Rails.logger.info Geoblacklight::ShapefileDownload.file_path.to_s
|
|
77
|
-
rescue Geoblacklight::Exceptions::ExternalDownloadFailed => e
|
|
78
|
-
Rails.logger.error e.message + " " + e.url
|
|
79
|
-
rescue NameError
|
|
80
|
-
Rails.logger.error "Could not find that download type \"#{args[:download_type]}\""
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
54
|
desc "Stdout output asset paths"
|
|
85
55
|
task application_asset_paths: [:environment] do
|
|
86
56
|
puts Rails.application.config.assets.paths
|
|
@@ -10,7 +10,7 @@ RSpec.describe Geoblacklight::Document::SidebarComponent, type: :component do
|
|
|
10
10
|
let(:document) { SolrDocument.new(JSON.parse(read_fixture(fixture))) }
|
|
11
11
|
|
|
12
12
|
before do
|
|
13
|
-
allow_any_instance_of(Geoblacklight::DownloadLinksComponent).to receive(:render?).and_return(false)
|
|
13
|
+
allow_any_instance_of(Geoblacklight::Document::DownloadLinksComponent).to receive(:render?).and_return(false)
|
|
14
14
|
allow_any_instance_of(Geoblacklight::LoginLinkComponent).to receive(:render?).and_return(false)
|
|
15
15
|
|
|
16
16
|
allow(document).to receive(:more_like_this).and_return([])
|
|
@@ -2,123 +2,97 @@
|
|
|
2
2
|
|
|
3
3
|
require "spec_helper"
|
|
4
4
|
|
|
5
|
-
RSpec.describe Geoblacklight::DownloadLinksComponent, type: :component do
|
|
5
|
+
RSpec.describe Geoblacklight::Document::DownloadLinksComponent, type: :component do
|
|
6
6
|
let(:downloadable) { true }
|
|
7
|
-
let(:
|
|
8
|
-
let(:
|
|
7
|
+
let(:direct_download) { nil }
|
|
8
|
+
let(:iiif_download) { nil }
|
|
9
|
+
let(:file_format) { nil }
|
|
10
|
+
let(:iiif_manifest) { nil }
|
|
11
|
+
let(:references) { instance_double("References", iiif_manifest: iiif_manifest) }
|
|
12
|
+
let(:document) do
|
|
13
|
+
instance_double(
|
|
14
|
+
SolrDocument, id: 123,
|
|
15
|
+
downloadable?: downloadable,
|
|
16
|
+
direct_download: direct_download,
|
|
17
|
+
iiif_download: iiif_download,
|
|
18
|
+
file_format: file_format,
|
|
19
|
+
references: references
|
|
20
|
+
)
|
|
21
|
+
end
|
|
22
|
+
subject(:component) { described_class.new(document: document) }
|
|
9
23
|
|
|
10
24
|
before do
|
|
11
25
|
allow_any_instance_of(GeoblacklightHelper).to receive(:document_available?).and_return(true)
|
|
26
|
+
render_inline(component)
|
|
12
27
|
end
|
|
13
28
|
|
|
14
|
-
context "when
|
|
15
|
-
|
|
16
|
-
allow(document).to receive(:direct_download).and_return(test: :test)
|
|
17
|
-
allow(document).to receive(:iiif_download).and_return({})
|
|
18
|
-
allow(document).to receive(:download_types).and_return(shapefile: {})
|
|
19
|
-
end
|
|
29
|
+
context "when not downloadable" do
|
|
30
|
+
let(:downloadable) { false }
|
|
20
31
|
|
|
21
|
-
it "
|
|
22
|
-
|
|
23
|
-
expect(page).to have_text("Download")
|
|
24
|
-
expect(page).to have_text("Export Shapefile")
|
|
32
|
+
it "does not render the component" do
|
|
33
|
+
is_expected.to_not be_render
|
|
25
34
|
end
|
|
26
35
|
end
|
|
27
36
|
|
|
28
|
-
context "
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
allow(document).to receive(:direct_download).and_return({})
|
|
32
|
-
allow(document).to receive(:iiif_download).and_return({})
|
|
33
|
-
allow(document).to receive(:download_types).and_return({})
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it "does not render anything" do
|
|
37
|
-
render_inline(component)
|
|
38
|
-
expect(page).not_to have_text("Download")
|
|
39
|
-
expect(page).not_to have_text("Export Shapefile")
|
|
40
|
-
end
|
|
37
|
+
context "with no download links and no IIIF links" do
|
|
38
|
+
it "does not render the component" do
|
|
39
|
+
is_expected.to_not be_render
|
|
41
40
|
end
|
|
41
|
+
end
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
context "with a single bare link" do
|
|
44
|
+
let(:direct_download) { {download: "file.zip"} }
|
|
45
|
+
let(:file_format) { "Shapefile" }
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
expect(page).not_to have_text("Download")
|
|
49
|
-
expect(page).not_to have_text("Export Shapefile")
|
|
50
|
-
end
|
|
47
|
+
it "renders a download link using the format to label it" do
|
|
48
|
+
expect(page).to have_link("Original Shapefile", href: "file.zip")
|
|
51
49
|
end
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
describe "#download_link_file" do
|
|
55
|
-
let(:label) { "Test Link Text" }
|
|
56
|
-
let(:id) { "test-id" }
|
|
57
|
-
let(:url) { "http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip" }
|
|
58
50
|
|
|
59
|
-
it "
|
|
60
|
-
expect(
|
|
61
|
-
url)).to eq '<a contentUrl="http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip" data-download="trigger" data-download-type="direct" data-download-id="test-id" href="http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip">Test Link Text</a>'
|
|
51
|
+
it "renders a badge indicating the actual file type" do
|
|
52
|
+
expect(page).to have_css(".badge", text: "ZIP")
|
|
62
53
|
end
|
|
63
54
|
end
|
|
64
55
|
|
|
65
|
-
|
|
66
|
-
let(:
|
|
67
|
-
let(:document_attributes) do
|
|
68
|
-
{
|
|
69
|
-
references_field => {
|
|
70
|
-
"http://iiif.io/api/image" => "https://example.edu/image/info.json"
|
|
71
|
-
}.to_json
|
|
72
|
-
}
|
|
73
|
-
end
|
|
74
|
-
let(:document) { SolrDocument.new(document_attributes, downloadable?: downloadable) }
|
|
56
|
+
context "with multiple labelled download links available" do
|
|
57
|
+
let(:direct_download) { {download: [{"label" => "File 1", "url" => "file.zip"}, {"label" => "File 2", "url" => "file2.json"}]} }
|
|
75
58
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
59
|
+
it "renders a labelled download link for each" do
|
|
60
|
+
expect(page).to have_link("File 1", href: "file.zip")
|
|
61
|
+
expect(page).to have_css(".badge", text: "ZIP")
|
|
62
|
+
expect(page).to have_link("File 2", href: "file2.json")
|
|
63
|
+
expect(page).to have_css(".badge", text: "JSON")
|
|
79
64
|
end
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
context "with a IIIF link" do
|
|
68
|
+
let(:iiif_download) { {iiif: "https://example.edu/image/info.json"} }
|
|
80
69
|
|
|
81
70
|
it "generates a link to download the JPG file from the IIIF server" do
|
|
82
|
-
expect(
|
|
71
|
+
expect(page).to have_link(href: "https://example.edu/image/full/full/0/default.jpg")
|
|
83
72
|
end
|
|
84
73
|
end
|
|
85
74
|
|
|
86
|
-
|
|
87
|
-
let(:
|
|
88
|
-
let(:document_attributes) do
|
|
89
|
-
{
|
|
90
|
-
references_field => {
|
|
91
|
-
"http://iiif.io/api/image" => "https://example.edu/image/info.json"
|
|
92
|
-
}.to_json
|
|
93
|
-
}
|
|
94
|
-
end
|
|
95
|
-
let(:document) { SolrDocument.new(document_attributes) }
|
|
75
|
+
context "with a IIIF manifest link" do
|
|
76
|
+
let(:iiif_manifest) { instance_double("IIIFManifest", endpoint: "https://example.edu/manifest.json") }
|
|
96
77
|
|
|
97
|
-
it "
|
|
98
|
-
expect(
|
|
78
|
+
it "generates a link to download the IIIF manifest" do
|
|
79
|
+
expect(page).to have_link(href: "https://example.edu/manifest.json")
|
|
99
80
|
end
|
|
100
81
|
end
|
|
101
82
|
|
|
102
|
-
|
|
103
|
-
let(:
|
|
83
|
+
context "with a generated download via WFS link" do
|
|
84
|
+
let(:direct_download) { {download: "https://geoportal.icpac.net/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typename=geonode%3Aa__2010_TC_Bandu0&outputFormat=json&srs=EPSG%3A4326&srsName=EPSG%3A4326"} }
|
|
104
85
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
allow(component).to receive(:export_format_label).and_return("Shapefile Export Customization")
|
|
108
|
-
allow(document).to receive(:id).and_return("test-id")
|
|
109
|
-
allow(document).to receive(:to_s).and_return("test-id")
|
|
86
|
+
it "renders a download link with the inferred file type" do
|
|
87
|
+
expect(page).to have_link("Generated JSON", href: "https://geoportal.icpac.net/geoserver/ows?service=WFS&version=1.0.0&request=GetFeature&typename=geonode%3Aa__2010_TC_Bandu0&outputFormat=json&srs=EPSG%3A4326&srsName=EPSG%3A4326")
|
|
110
88
|
end
|
|
89
|
+
end
|
|
111
90
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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)")
|
|
120
|
-
expect(component.download_link_generated(download_type,
|
|
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>'
|
|
91
|
+
context "with a generated download using the format parameter" do
|
|
92
|
+
let(:direct_download) { {download: "https://example.edu/file?format=CSV"} }
|
|
93
|
+
|
|
94
|
+
it "renders a download link with the inferred file type" do
|
|
95
|
+
expect(page).to have_link("Generated CSV", href: "https://example.edu/file?format=CSV")
|
|
122
96
|
end
|
|
123
97
|
end
|
|
124
98
|
end
|
|
@@ -21,32 +21,6 @@ RSpec.feature "Index view", js: true do
|
|
|
21
21
|
expect(page).to have_css("#per_page-dropdown")
|
|
22
22
|
end
|
|
23
23
|
|
|
24
|
-
scenario "should have facets listed correctly" do
|
|
25
|
-
skip "Capybara thinks elements are not visible or interactable, but they are"
|
|
26
|
-
|
|
27
|
-
within "#facet-panel-collapse", visible: :all do
|
|
28
|
-
expect(page).to have_css("div.card.facet-limit", text: "Year", visible: :all)
|
|
29
|
-
expect(page).to have_css("div.card.facet-limit", text: "Place", visible: :all)
|
|
30
|
-
expect(page).to have_css("div.card.facet-limit", text: "Access", visible: :all)
|
|
31
|
-
expect(page).to have_css("div.card.facet-limit", text: "Resource Class", visible: :all)
|
|
32
|
-
expect(page).to have_css("div.card.facet-limit", text: "Resource Type", visible: :all)
|
|
33
|
-
expect(page).to have_css("div.card.facet-limit", text: "Format", visible: :all)
|
|
34
|
-
expect(page).to have_css("div.card.facet-limit", text: "Subject", visible: :all)
|
|
35
|
-
expect(page).to have_css("div.card.facet-limit", text: "Theme", visible: :all)
|
|
36
|
-
expect(page).to have_css("div.card.facet-limit", text: "Creator", visible: :all)
|
|
37
|
-
expect(page).to have_css("div.card.facet-limit", text: "Publisher", visible: :all)
|
|
38
|
-
expect(page).to have_css("div.card.facet-limit", text: "Provider", visible: :all)
|
|
39
|
-
expect(page).to have_css("div.card.facet-limit", text: "Georeferenced", visible: :all)
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
click_button "Provider", visible: :all
|
|
43
|
-
|
|
44
|
-
expect(page).to have_css("a.facet-select", text: "University of Minnesota", visible: :all)
|
|
45
|
-
expect(page).to have_css("a.facet-select", text: "MIT", visible: :all)
|
|
46
|
-
expect(page).to have_css("a.facet-select", text: "Stanford", visible: :all)
|
|
47
|
-
expect(page).to have_css(".more_facets a", text: /more\sProvider\s»/, visible: :all)
|
|
48
|
-
end
|
|
49
|
-
|
|
50
24
|
scenario "hover on record should produce bounding box on map" do
|
|
51
25
|
# Needed to find an svg element on the page
|
|
52
26
|
visit search_catalog_path(f: {Geoblacklight.configuration.fields.provider => ["Stanford"]})
|
|
@@ -66,13 +40,6 @@ RSpec.feature "Index view", js: true do
|
|
|
66
40
|
end
|
|
67
41
|
end
|
|
68
42
|
|
|
69
|
-
scenario "spatial search should reset to page one" do
|
|
70
|
-
skip "FIXME: Only works with a headful browser?"
|
|
71
|
-
visit "/?per_page=5&q=%2A&page=2"
|
|
72
|
-
find("#leaflet-viewer").double_click
|
|
73
|
-
expect(page).to have_css ".page-entries", text: /^1 - 5 of \d.*$/
|
|
74
|
-
end
|
|
75
|
-
|
|
76
43
|
scenario "clicking map search should retain current search parameters" do
|
|
77
44
|
visit "/?f[#{subject_field}][]=Population"
|
|
78
45
|
find("#leaflet-viewer").double_click
|
|
@@ -9,14 +9,4 @@ RSpec.feature "Layer inspection", js: true do
|
|
|
9
9
|
find("#leaflet-viewer").click
|
|
10
10
|
expect(page).not_to have_css("td.default-text")
|
|
11
11
|
end
|
|
12
|
-
|
|
13
|
-
context "with a pmtiles layer" do
|
|
14
|
-
scenario "clicking map should trigger inspection" do
|
|
15
|
-
skip "FIXME: Only works with a headful browser?"
|
|
16
|
-
visit solr_document_path("princeton-t722hd30j")
|
|
17
|
-
expect(page).to have_css("th", text: "Attribute")
|
|
18
|
-
find("#openlayers-viewer").click
|
|
19
|
-
expect(page).not_to have_css("td.default-text")
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
12
|
end
|
|
@@ -9,13 +9,6 @@ RSpec.feature "Layer opacity", js: true do
|
|
|
9
9
|
expect(page.all("div.leaflet-layer")[1][:style]).to match(/opacity: 0.75;/)
|
|
10
10
|
end
|
|
11
11
|
|
|
12
|
-
scenario "ESRI image service layer should have opacity control" do
|
|
13
|
-
skip "CORS error - Purdue web services are down"
|
|
14
|
-
visit solr_document_path("32653ed6-8d83-4692-8a06-bf13ffe2c018")
|
|
15
|
-
expect(page).to have_css("div.opacity-text", text: "75%")
|
|
16
|
-
expect(page.find("img.leaflet-image-layer", match: :first)[:style]).to match(/opacity: 0.75;/)
|
|
17
|
-
end
|
|
18
|
-
|
|
19
12
|
scenario "IIIF layer should not have opacity control" do
|
|
20
13
|
visit solr_document_path("princeton-02870w62c")
|
|
21
14
|
expect(page).not_to have_css("div.opacity-text", text: "75%")
|
|
@@ -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" data-read-more-text="Read more" data-close-text="Close">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
|
|
@@ -20,7 +20,6 @@ RSpec.describe Geoblacklight::Configuration::SettingsBuilder do
|
|
|
20
20
|
{
|
|
21
21
|
institution: "MIT",
|
|
22
22
|
fields: {title: "my_title_s"},
|
|
23
|
-
download_formats: {vector: ["GeoJSON"]},
|
|
24
23
|
leaflet: {selected_color: "#abc123", sidebar: true}
|
|
25
24
|
}
|
|
26
25
|
end
|
|
@@ -31,7 +30,6 @@ RSpec.describe Geoblacklight::Configuration::SettingsBuilder do
|
|
|
31
30
|
|
|
32
31
|
it "resolves nested lowercase keys" do
|
|
33
32
|
expect(config.fields.title).to eq("my_title_s")
|
|
34
|
-
expect(config.vector_download_formats).to eq(["GeoJSON"])
|
|
35
33
|
expect(config.leaflet_options.selected_color).to eq("#abc123")
|
|
36
34
|
expect(config.leaflet_options.sidebar).to be true
|
|
37
35
|
end
|
|
@@ -165,29 +165,6 @@ RSpec.describe Geoblacklight::References do
|
|
|
165
165
|
expect(typical_ogp_shapefile.download).to be_nil
|
|
166
166
|
end
|
|
167
167
|
end
|
|
168
|
-
describe "preferred_download" do
|
|
169
|
-
it "returns the direct download if available" do
|
|
170
|
-
expect(complex_shapefile.preferred_download[:file_download][:download]).to eq "http://example.com/urn:hul.harvard.edu:HARVARD.SDE2.TG10USAIANNH/data.zip"
|
|
171
|
-
expect(direct_download_only.preferred_download[:file_download][:download]).to eq "http://example.com/layer-id-geotiff.tiff"
|
|
172
|
-
end
|
|
173
|
-
it "returns nil if there is no direct download" do
|
|
174
|
-
expect(typical_ogp_shapefile.preferred_download).to be_nil
|
|
175
|
-
expect(typical_ogp_geotiff.preferred_download).to be_nil
|
|
176
|
-
end
|
|
177
|
-
end
|
|
178
|
-
describe "download_types" do
|
|
179
|
-
it "returns available downloads by format" do
|
|
180
|
-
types = complex_shapefile.download_types
|
|
181
|
-
expect(types.first[1]).to eq wfs: "http://hgl.harvard.edu:8080/geoserver/wfs"
|
|
182
|
-
expect(types.count).to eq 4
|
|
183
|
-
expect(direct_download_only.download_types).to be_nil
|
|
184
|
-
end
|
|
185
|
-
it "onlies return available downloads if no direct is present" do
|
|
186
|
-
types = typical_ogp_shapefile.download_types
|
|
187
|
-
expect(types.first[1]).to eq wfs: "http://hgl.harvard.edu:8080/geoserver/wfs"
|
|
188
|
-
expect(types.count).to eq 4
|
|
189
|
-
end
|
|
190
|
-
end
|
|
191
168
|
describe "#esri_webservices" do
|
|
192
169
|
it "returns webservices that are esri specific" do
|
|
193
170
|
expect(some_esri_services.esri_webservices.length).to eq 3
|
|
@@ -201,7 +178,7 @@ RSpec.describe Geoblacklight::References do
|
|
|
201
178
|
describe "#respond_to_missing?" do
|
|
202
179
|
context "with a valid method" do
|
|
203
180
|
it "returns true" do
|
|
204
|
-
expect(typical_ogp_shapefile.respond_to?(:
|
|
181
|
+
expect(typical_ogp_shapefile.respond_to?(:esri_webservices)).to be true
|
|
205
182
|
end
|
|
206
183
|
end
|
|
207
184
|
context "with a invalid method" do
|
|
@@ -210,37 +187,4 @@ RSpec.describe Geoblacklight::References do
|
|
|
210
187
|
end
|
|
211
188
|
end
|
|
212
189
|
end
|
|
213
|
-
describe "downloads_by_format" do
|
|
214
|
-
context "using default settings for vector download formats" do
|
|
215
|
-
it "returns shapefile" do
|
|
216
|
-
expect(typical_ogp_shapefile.downloads_by_format.count).to eq 4
|
|
217
|
-
expect(typical_ogp_shapefile.downloads_by_format[:csv][:wfs]).to eq "http://hgl.harvard.edu:8080/geoserver/wfs"
|
|
218
|
-
expect(typical_ogp_shapefile.downloads_by_format[:geojson][:wfs]).to eq "http://hgl.harvard.edu:8080/geoserver/wfs"
|
|
219
|
-
expect(typical_ogp_shapefile.downloads_by_format[:kmz][:wms]).to eq "http://hgl.harvard.edu:8080/geoserver/wms"
|
|
220
|
-
expect(typical_ogp_shapefile.downloads_by_format[:shapefile][:wfs]).to eq "http://hgl.harvard.edu:8080/geoserver/wfs"
|
|
221
|
-
end
|
|
222
|
-
it "returns geotiff" do
|
|
223
|
-
expect(typical_ogp_geotiff.downloads_by_format.count).to eq 1
|
|
224
|
-
expect(typical_ogp_geotiff.downloads_by_format[:geotiff][:wms]).to eq "http://hgl.harvard.edu:8080/geoserver/wms"
|
|
225
|
-
end
|
|
226
|
-
it "returns arcgrid as geotiff" do
|
|
227
|
-
expect(typical_arcgrid.downloads_by_format.count).to eq 1
|
|
228
|
-
expect(typical_arcgrid.downloads_by_format[:geotiff][:wms]).to eq "http://hgl.harvard.edu:8080/geoserver/wms"
|
|
229
|
-
end
|
|
230
|
-
it "does not return shapefile if wms and wfs are not present" do
|
|
231
|
-
expect(no_service_shapefile.downloads_by_format).to be_nil
|
|
232
|
-
end
|
|
233
|
-
it "does not return GeoTIFF if wms is not present" do
|
|
234
|
-
expect(direct_download_only.downloads_by_format).to be_nil
|
|
235
|
-
end
|
|
236
|
-
end
|
|
237
|
-
context "using custom settings which include incorrect settings" do
|
|
238
|
-
before do
|
|
239
|
-
allow(typical_ogp_shapefile).to receive(:format_list).and_return(["noformat"])
|
|
240
|
-
end
|
|
241
|
-
it "returns no formats for download" do
|
|
242
|
-
expect(typical_ogp_shapefile.downloads_by_format.count).to eq 0
|
|
243
|
-
end
|
|
244
|
-
end
|
|
245
|
-
end
|
|
246
190
|
end
|
|
@@ -105,13 +105,6 @@ RSpec.describe Geoblacklight::SolrDocument do
|
|
|
105
105
|
expect(document.references).to be_an Geoblacklight::References
|
|
106
106
|
end
|
|
107
107
|
end
|
|
108
|
-
describe "download_types" do
|
|
109
|
-
let(:document_attributes) { {} }
|
|
110
|
-
it "calls download_types" do
|
|
111
|
-
expect_any_instance_of(Geoblacklight::References).to receive(:download_types)
|
|
112
|
-
document.download_types
|
|
113
|
-
end
|
|
114
|
-
end
|
|
115
108
|
describe "direct_download" do
|
|
116
109
|
let(:document_attributes) { {} }
|
|
117
110
|
describe "with a direct download" do
|
data/template.rb
CHANGED
|
@@ -10,7 +10,7 @@ end
|
|
|
10
10
|
run "bundle install"
|
|
11
11
|
|
|
12
12
|
after_bundle do
|
|
13
|
-
generate "blacklight:install", ENV.fetch("BLACKLIGHT_INSTALL_OPTIONS", "--devise
|
|
13
|
+
generate "blacklight:install", ENV.fetch("BLACKLIGHT_INSTALL_OPTIONS", "--devise")
|
|
14
14
|
generate "geoblacklight:install"
|
|
15
15
|
rails_command "db:migrate"
|
|
16
16
|
end
|