blacklight-maps 0.3.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/.rubocop.yml +99 -0
- data/.solr_wrapper.yml +7 -0
- data/.travis.yml +19 -16
- data/Gemfile +40 -18
- data/README.md +22 -11
- data/Rakefile +35 -32
- data/app/assets/images/blacklight/maps.svg +1 -0
- data/app/assets/javascripts/blacklight-maps.js +1 -4
- data/app/assets/javascripts/blacklight-maps/blacklight-maps-browse.js +21 -11
- data/app/assets/stylesheets/blacklight_maps/{blacklight-maps.css.scss → blacklight-maps.scss} +1 -2
- data/app/assets/stylesheets/blacklight_maps/{default.css.scss → default.scss} +7 -10
- data/app/helpers/blacklight/blacklight_maps_helper_behavior.rb +81 -86
- data/app/helpers/blacklight_maps_helper.rb +2 -0
- data/app/views/catalog/_document_maps.html.erb +1 -1
- data/app/views/catalog/{_index_map.html.erb → _index_mapview.html.erb} +1 -1
- data/app/views/catalog/_show_maplet_default.html.erb +8 -9
- data/app/views/catalog/map.html.erb +2 -2
- data/blacklight-maps.gemspec +27 -26
- data/config/locales/blacklight-maps-zh.yml +20 -0
- data/config/locales/blacklight-maps.ar.yml +21 -0
- data/config/locales/blacklight-maps.de.yml +21 -0
- data/config/locales/blacklight-maps.en.yml +1 -1
- data/config/locales/blacklight-maps.es.yml +21 -0
- data/config/locales/blacklight-maps.fr.yml +20 -0
- data/config/locales/blacklight-maps.hu.yml +21 -0
- data/config/locales/blacklight-maps.it.yml +20 -0
- data/config/locales/blacklight-maps.nl.yml +21 -0
- data/config/locales/blacklight-maps.pt-BR.yml +21 -0
- data/config/locales/blacklight-maps.sq.yml +21 -0
- data/config/routes.rb +3 -2
- data/lib/blacklight/maps.rb +8 -14
- data/lib/blacklight/maps/controller.rb +27 -0
- data/lib/blacklight/maps/engine.rb +17 -19
- data/lib/blacklight/maps/export.rb +112 -93
- data/lib/blacklight/maps/geometry.rb +30 -18
- data/lib/blacklight/maps/maps_search_builder.rb +26 -0
- data/lib/blacklight/maps/render_constraints_override.rb +63 -30
- data/lib/blacklight/maps/version.rb +3 -1
- data/lib/generators/blacklight_maps/install_generator.rb +56 -13
- data/lib/generators/blacklight_maps/templates/search_history_controller.rb +7 -0
- data/{solr_conf → lib/generators/blacklight_maps/templates/solr}/conf/schema.xml +0 -0
- data/{solr_conf → lib/generators/blacklight_maps/templates/solr}/conf/solrconfig.xml +0 -0
- data/lib/railties/blacklight_maps.rake +13 -9
- data/spec/controllers/catalog_controller_spec.rb +20 -10
- data/spec/fixtures/sample_solr_documents.yml +955 -852
- data/spec/helpers/blacklight_maps_helper_spec.rb +61 -106
- data/spec/lib/blacklight/maps/export_spec.rb +109 -143
- data/spec/lib/blacklight/maps/geometry_spec.rb +34 -21
- data/spec/lib/blacklight/maps/maps_search_builder_spec.rb +42 -0
- data/spec/lib/blacklight/maps/render_constraints_override_spec.rb +42 -69
- data/spec/spec_helper.rb +19 -21
- data/spec/system/index_view_spec.rb +127 -0
- data/spec/system/initial_view_spec.rb +28 -0
- data/spec/system/map_view_spec.rb +50 -0
- data/spec/system/show_view_maplet_spec.rb +78 -0
- data/spec/test_app_templates/lib/generators/test_app_generator.rb +8 -14
- data/vendor/assets/images/layers-2x.png +0 -0
- data/vendor/assets/images/layers.png +0 -0
- data/vendor/assets/images/marker-icon-2x.png +0 -0
- data/vendor/assets/images/marker-icon.png +0 -0
- data/vendor/assets/images/marker-shadow.png +0 -0
- data/vendor/assets/javascripts/leaflet.js.erb +13922 -0
- data/vendor/assets/javascripts/leaflet.markercluster.js +3 -0
- data/vendor/assets/stylesheets/MarkerCluster.Default.css +60 -0
- data/vendor/assets/stylesheets/MarkerCluster.css +14 -0
- data/vendor/assets/stylesheets/leaflet.css +635 -0
- metadata +100 -89
- data/config/jetty.yml +0 -7
- data/lib/blacklight/maps/controller_override.rb +0 -33
- data/spec/features/initial_view_spec.rb +0 -21
- data/spec/features/maps_spec.rb +0 -252
- data/spec/lib/blacklight/maps/controller_override_spec.rb +0 -34
- data/spec/test_app_templates/Gemfile.extra +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b23c73a0ba75175cfe101746f9ff1ae0592a42556a34c9d1e4fe8cc2c42b8081
|
4
|
+
data.tar.gz: ce938a6f2884faccb3051985ab84fe0bf40505f1246fe56ca1d2621ca823b2a9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c83862d2c315629f8610d15978b386aa7f9e6d889a82fd70ef540870f6b7e80bb6c0cd2b507bbf06019f31b39a68f34970721d90bffb1bc747b86fec433c8607
|
7
|
+
data.tar.gz: e1de2250bbe1f18826ff9ab17f814ef3e2ce53e745fd0c66e3f19c2de7f45e13bff72224da8d042ca91ae0546ad87c673e93cd136fe84d3abb8927b98f374b2c
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
AllCops:
|
4
|
+
DisplayCopNames: true
|
5
|
+
TargetRubyVersion: 2.3
|
6
|
+
Exclude:
|
7
|
+
- "lib/generators/blacklight_maps/templates/**/*"
|
8
|
+
- "blacklight-maps.gemspec"
|
9
|
+
|
10
|
+
# engine_cart block includes conditional, not duplication
|
11
|
+
Bundler/DuplicatedGem:
|
12
|
+
Exclude:
|
13
|
+
- 'Gemfile'
|
14
|
+
|
15
|
+
# engine_cart block is following default Rails order
|
16
|
+
Bundler/OrderedGems:
|
17
|
+
Exclude:
|
18
|
+
- 'Gemfile'
|
19
|
+
|
20
|
+
Layout/IndentationConsistency:
|
21
|
+
EnforcedStyle: normal
|
22
|
+
|
23
|
+
Metrics/AbcSize:
|
24
|
+
Max: 20
|
25
|
+
Exclude:
|
26
|
+
- 'lib/blacklight/maps/maps_search_builder.rb'
|
27
|
+
|
28
|
+
Metrics/BlockLength:
|
29
|
+
Exclude:
|
30
|
+
- "spec/**/*"
|
31
|
+
|
32
|
+
Metrics/ClassLength:
|
33
|
+
Exclude:
|
34
|
+
- 'lib/blacklight/maps/export.rb'
|
35
|
+
|
36
|
+
Metrics/LineLength:
|
37
|
+
Max: 200
|
38
|
+
Exclude:
|
39
|
+
- 'lib/blacklight/maps/engine.rb'
|
40
|
+
- 'spec/**/*'
|
41
|
+
|
42
|
+
Metrics/MethodLength:
|
43
|
+
Max: 15
|
44
|
+
|
45
|
+
Naming/HeredocDelimiterNaming:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Naming/PredicateName:
|
49
|
+
NamePrefixBlacklist:
|
50
|
+
- is_
|
51
|
+
|
52
|
+
Rails:
|
53
|
+
Enabled: true
|
54
|
+
|
55
|
+
Rails/OutputSafety:
|
56
|
+
Enabled: false
|
57
|
+
|
58
|
+
RSpec/AnyInstance:
|
59
|
+
Exclude:
|
60
|
+
- 'spec/system/initial_view_spec.rb'
|
61
|
+
|
62
|
+
RSpec/BeforeAfterAll:
|
63
|
+
Enabled: false
|
64
|
+
|
65
|
+
RSpec/DescribeClass:
|
66
|
+
Exclude:
|
67
|
+
- 'spec/system/*'
|
68
|
+
|
69
|
+
RSpec/FilePath:
|
70
|
+
Exclude:
|
71
|
+
- 'spec/lib/blacklight/maps/*'
|
72
|
+
|
73
|
+
RSpec/MessageSpies:
|
74
|
+
EnforcedStyle: receive
|
75
|
+
|
76
|
+
RSpec/MultipleExpectations:
|
77
|
+
Max: 4
|
78
|
+
|
79
|
+
RSpec/NestedGroups:
|
80
|
+
Max: 5
|
81
|
+
|
82
|
+
RSpec/PredicateMatcher:
|
83
|
+
Exclude:
|
84
|
+
- 'spec/lib/blacklight/maps/render_constraints_override_spec.rb'
|
85
|
+
|
86
|
+
# https://github.com/rubocop-hq/rubocop/issues/6439
|
87
|
+
Style/AccessModifierDeclarations:
|
88
|
+
Enabled: false
|
89
|
+
|
90
|
+
Style/BracesAroundHashParameters:
|
91
|
+
Exclude:
|
92
|
+
- 'spec/lib/blacklight/maps/export_spec.rb'
|
93
|
+
|
94
|
+
Style/Documentation:
|
95
|
+
Enabled: false
|
96
|
+
|
97
|
+
Style/SignalException:
|
98
|
+
Exclude:
|
99
|
+
- 'spec/**/*'
|
data/.solr_wrapper.yml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Place any default configuration for solr_wrapper here
|
2
|
+
# you must first run 'rake engine_cart:generate' to create the test app
|
3
|
+
# before running 'solr_wrapper' from project root
|
4
|
+
# port: 8983
|
5
|
+
collection:
|
6
|
+
dir: ./.internal_test_app/solr/conf/
|
7
|
+
name: blacklight-core
|
data/.travis.yml
CHANGED
@@ -1,25 +1,28 @@
|
|
1
|
-
notifications:
|
2
|
-
email: false
|
3
1
|
language: ruby
|
4
2
|
sudo: false
|
5
|
-
|
6
|
-
- 2.2.0
|
7
|
-
- 2.1.0
|
8
|
-
- 2.0.0
|
9
|
-
- 1.9.3
|
10
|
-
- jruby-19mode
|
3
|
+
dist: bionic
|
11
4
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
5
|
+
addons:
|
6
|
+
chrome: stable
|
7
|
+
|
8
|
+
before_install:
|
9
|
+
- google-chrome-stable --headless --disable-gpu --no-sandbox --remote-debugging-port=9222 http://localhost &
|
16
10
|
|
17
11
|
env:
|
18
12
|
global:
|
19
|
-
- JRUBY_OPTS="-J-Xms512m -J-Xmx1024m"
|
20
13
|
- NOKOGIRI_USE_SYSTEM_LIBRARIES=true
|
14
|
+
- ENGINE_CART_RAILS_OPTIONS='--skip-git --skip-listen --skip-spring --skip-keeps --skip-action-cable --skip-coffee --skip-test'
|
21
15
|
|
22
16
|
matrix:
|
23
|
-
|
24
|
-
- rvm:
|
25
|
-
|
17
|
+
include:
|
18
|
+
- rvm: 2.7.0
|
19
|
+
env: "RAILS_VERSION=6.0.2.2"
|
20
|
+
- rvm: 2.6.5
|
21
|
+
env: "RAILS_VERSION=6.0.2.2"
|
22
|
+
- rvm: 2.6.5
|
23
|
+
env: "RAILS_VERSION=5.2.4.2"
|
24
|
+
- rvm: 2.5.7
|
25
|
+
env: "RAILS_VERSION=5.2.4.2"
|
26
|
+
fast_finish: true
|
27
|
+
|
28
|
+
jdk: openjdk11
|
data/Gemfile
CHANGED
@@ -1,26 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
source 'https://rubygems.org'
|
2
4
|
|
3
|
-
# Specify your gem's dependencies in blacklight-maps.gemspec
|
4
5
|
gemspec
|
5
6
|
|
6
|
-
|
7
|
-
# Gemfile.lock but since sass-rails gets generated (rails new) into the test app
|
8
|
-
# it'll want sprockets 2.11.0 and we'll have a conflict
|
9
|
-
gem 'sprockets', '2.11.0'
|
10
|
-
|
11
|
-
# If we don't specify 3.2.15 we'll end up with sass 3.3.2 in the main
|
12
|
-
# Gemfile.lock but since sass-rails gets generated (rails new) into the test app
|
13
|
-
# it'll want sass 3.2.0 and we'll have a conflict
|
14
|
-
gem 'sass', '~> 3.2.0'
|
15
|
-
gem 'bootstrap-sass', ">= 3.1.1.1"
|
16
|
-
|
17
|
-
group :test do
|
18
|
-
gem 'simplecov', require: false
|
7
|
+
group :development, :test do
|
19
8
|
gem 'coveralls', require: false
|
20
9
|
end
|
21
10
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
11
|
+
gem 'engine_cart'
|
12
|
+
# BEGIN ENGINE_CART BLOCK
|
13
|
+
# engine_cart: 1.2.0
|
14
|
+
# engine_cart stanza: 0.10.0
|
15
|
+
# the below comes from engine_cart, a gem used to test this Rails engine gem in the context of a Rails app.
|
16
|
+
file = File.expand_path('Gemfile', ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || File.expand_path('.internal_test_app', File.dirname(__FILE__)))
|
17
|
+
if File.exist?(file)
|
18
|
+
begin
|
19
|
+
eval_gemfile file
|
20
|
+
rescue Bundler::GemfileError => e
|
21
|
+
Bundler.ui.warn '[EngineCart] Skipping Rails application dependencies:'
|
22
|
+
Bundler.ui.warn e.message
|
23
|
+
end
|
24
|
+
else
|
25
|
+
Bundler.ui.warn "[EngineCart] Unable to find test application dependencies in #{file}, using placeholder dependencies"
|
26
|
+
|
27
|
+
if ENV['RAILS_VERSION']
|
28
|
+
if ENV['RAILS_VERSION'] == 'edge'
|
29
|
+
gem 'rails', github: 'rails/rails'
|
30
|
+
ENV['ENGINE_CART_RAILS_OPTIONS'] = '--edge --skip-turbolinks'
|
31
|
+
else
|
32
|
+
gem 'rails', ENV['RAILS_VERSION']
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
case ENV['RAILS_VERSION']
|
37
|
+
when /^5.[12]/, /^6.0/
|
38
|
+
gem 'sass-rails', '~> 5.0'
|
39
|
+
when /^4.2/
|
40
|
+
gem 'responders', '~> 2.0'
|
41
|
+
gem 'sass-rails', '>= 5.0'
|
42
|
+
gem 'coffee-rails', '~> 4.1.0'
|
43
|
+
gem 'json', '~> 1.8'
|
44
|
+
when /^4.[01]/
|
45
|
+
gem 'sass-rails', '< 5.0'
|
46
|
+
end
|
26
47
|
end
|
48
|
+
# END ENGINE_CART BLOCK
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Blacklight::Maps
|
2
2
|
|
3
|
-
[![Build Status](https://travis-ci.org/projectblacklight/blacklight-maps.png?branch=master)](https://travis-ci.org/
|
3
|
+
[![Build Status](https://travis-ci.org/projectblacklight/blacklight-maps.png?branch=master)](https://travis-ci.org/projectblacklight/blacklight-maps) | [![Coverage Status](https://coveralls.io/repos/projectblacklight/blacklight-maps/badge.svg?branch=master)](https://coveralls.io/r/projectblacklight/blacklight-maps?branch=master)
|
4
4
|
|
5
5
|
Provides map views for Blacklight for items with geospatial coordinate (latitude/longitude) metadata.
|
6
6
|
|
@@ -15,6 +15,8 @@ Maplet widget in item detail view:
|
|
15
15
|
|
16
16
|
## Installation
|
17
17
|
|
18
|
+
(See [Blacklight Version Compatibility](#blacklight-compatibility) below to make sure you're using a version of the gem that works with the version of Blacklight you're using.)
|
19
|
+
|
18
20
|
Add this line to your application's Gemfile:
|
19
21
|
|
20
22
|
gem 'blacklight-maps'
|
@@ -51,11 +53,11 @@ Blacklight-Maps requires that your Solr index include at least one (but preferab
|
|
51
53
|
|
52
54
|
```
|
53
55
|
# coordinates: lon lat or lat,lon
|
54
|
-
# bounding box: minX
|
55
|
-
|
56
|
+
# bounding box: ENVELOPE(minX, maxX, maxY, minY)
|
57
|
+
coordinates_srpt:
|
56
58
|
- 78.96288 20.593684
|
57
59
|
- 20.593684,78.96288
|
58
|
-
- 68.162386
|
60
|
+
- ENVELOPE(68.162386, 97.395555, 35.5044752, 6.7535159)
|
59
61
|
```
|
60
62
|
|
61
63
|
2. An indexed, stored string field containing a properly-formatted [GeoJSON](http://geojson.org) feature object for a point or bounding box that includes the coordinates and (preferably) location name. This field can be multivalued.
|
@@ -72,7 +74,7 @@ Blacklight-Maps requires that your Solr index include at least one (but preferab
|
|
72
74
|
3. An indexed, stored text or string field containing location names. This field can be multivalued.
|
73
75
|
|
74
76
|
```
|
75
|
-
|
77
|
+
subject_geo_ssim: India
|
76
78
|
```
|
77
79
|
|
78
80
|
##### Why so complicated?
|
@@ -86,10 +88,10 @@ Blacklight-Maps can be used with either field type (#1 or #2), however to take a
|
|
86
88
|
**Important:** If you are NOT using the geojson field (#2), you should create a `copyField` in your Solr schema.xml to copy the coordinates from the `location_rpt` field to a string field that is stored, indexed, and multivalued to allow for proper faceting of the coordinate values in the catalog#map and catalog#index views.
|
87
89
|
|
88
90
|
```
|
89
|
-
<!--
|
90
|
-
<dynamicField name="
|
91
|
+
<!-- Solr location_rpt field for coordinates, shapes, etc. -->
|
92
|
+
<dynamicField name="*_srpt" type="location_rpt" indexed="true" stored="true" multiValued="true" />
|
91
93
|
<!-- copy geospatial to string field for faceting -->
|
92
|
-
<copyField source="
|
94
|
+
<copyField source="coordinates_srpt" dest="coordinates_ssim" />
|
93
95
|
```
|
94
96
|
|
95
97
|
Support for additional field types may be added in the future.
|
@@ -110,9 +112,9 @@ Blacklight-Maps expects you to provide these configuration options:
|
|
110
112
|
+ `placename_field` = the name of the Solr field containing the location names
|
111
113
|
+ `coordinates_field` = the name of the Solr `location_rpt` type field containing geospatial coordinate data
|
112
114
|
|
113
|
-
In addition, you must add the geospatial facet field to the list of facet fields:
|
115
|
+
In addition, you must add the geospatial facet field to the list of facet fields in `app/controllers/catalog_controller.rb`, for example:
|
114
116
|
```ruby
|
115
|
-
config.add_facet_field '
|
117
|
+
config.add_facet_field 'geojson_ssim', :limit => -2, :label => 'Coordinates', :show => false
|
116
118
|
```
|
117
119
|
|
118
120
|
#### Optional
|
@@ -181,7 +183,7 @@ Option | Type | Default | Description
|
|
181
183
|
`catalogpath` | String | `'catalog'` | the search path for the search control
|
182
184
|
`placenamefield` | String | `'placename_field'` | the name of the Solr field containing the location names
|
183
185
|
`searchctrlcue` | String | `'Search for all items within the current map window'` | the hover text to display when the mouse hovers over the ![search control](docs/blacklight-maps_search-control.png) search control
|
184
|
-
`searchresultsview` | String | `'list'` | the view type for the search results on the catalog#index page after the ![search control](docs/blacklight-maps_search-control.png) search control is used
|
186
|
+
`searchresultsview` | String | `'list'` | the view type for the search results on the catalog#index page after the map ![search control](docs/blacklight-maps_search-control.png) search control is used
|
185
187
|
`singlemarkermode` | Boolean | `true` | whether locations should be clustered
|
186
188
|
`clustercount` | String | `'locations'` | whether clusters should display the location count or the number of hits (`'hits'` or `'locations'`)
|
187
189
|
`maxzoom` | Integer | 18 | the maxZoom [property of the map](http://leafletjs.com/reference.html#map-maxzoom)
|
@@ -189,6 +191,15 @@ Option | Type | Default | Description
|
|
189
191
|
`mapattribution` | String | ``Map data © <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, <a href="http://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>'` | an [attribution string](http://leafletjs.com/reference.html#tilelayer-attribution) to describe the basemap layer
|
190
192
|
`nodata` | String | `'Sorry, there is no data for this location.'` | a message to display in the Leaflet popup when the "popup" member is not present in the properties hash in the GeoJSON Feature for a location.
|
191
193
|
|
194
|
+
### <a name="blacklight-compatibility"></a>Blacklight Version Compatibility
|
195
|
+
The table below indicates which versions of Blacklight Maps are compatible with which versions of Blacklight.
|
196
|
+
|
197
|
+
Blacklight Maps version | works with Blacklight version
|
198
|
+
----------------------- | ---------------------
|
199
|
+
1.1.* | >= 7.8.0, < 8
|
200
|
+
0.5.* | >= 6.1.0, < 7
|
201
|
+
0.4.* | >= 5.12.0, < 6.*
|
202
|
+
<= 0.3.3 | >= 5.1, <= 5.11.2
|
192
203
|
|
193
204
|
## Contributing
|
194
205
|
|
data/Rakefile
CHANGED
@@ -1,43 +1,46 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
3
|
+
begin
|
4
|
+
require 'bundler/setup'
|
5
|
+
rescue LoadError
|
6
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
7
|
+
end
|
8
8
|
|
9
|
-
require '
|
9
|
+
require 'rdoc/task'
|
10
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
11
|
+
rdoc.rdoc_dir = 'rdoc'
|
12
|
+
rdoc.title = 'BlacklightMaps'
|
13
|
+
rdoc.options << '--line-numbers'
|
14
|
+
rdoc.rdoc_files.include('README.rdoc')
|
15
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
16
|
+
end
|
10
17
|
|
11
|
-
|
18
|
+
Bundler::GemHelper.install_tasks
|
12
19
|
|
13
|
-
|
20
|
+
Rake::Task.define_task(:environment)
|
14
21
|
|
15
|
-
|
16
|
-
task :fixtures => ['engine_cart:generate'] do
|
17
|
-
EngineCart.within_test_app do
|
18
|
-
system "rake blacklight_maps:solr:seed RAILS_ENV=test"
|
19
|
-
end
|
20
|
-
end
|
22
|
+
load 'lib/railties/blacklight_maps.rake'
|
21
23
|
|
22
|
-
|
23
|
-
task :ci => ['engine_cart:generate', 'jetty:clean', 'blacklight_maps:configure_jetty'] do
|
24
|
-
|
25
|
-
require 'jettywrapper'
|
26
|
-
jetty_params = Jettywrapper.load_config('test')
|
24
|
+
task default: :ci
|
27
25
|
|
28
|
-
|
29
|
-
Rake::Task['fixtures'].invoke
|
30
|
-
Rake::Task['spec'].invoke
|
31
|
-
end
|
32
|
-
raise "test failures: #{error}" if error
|
33
|
-
end
|
26
|
+
require 'engine_cart/rake_task'
|
34
27
|
|
28
|
+
require 'solr_wrapper'
|
35
29
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
RSpec::Core::RakeTask.new
|
32
|
+
|
33
|
+
require 'rubocop/rake_task'
|
34
|
+
RuboCop::RakeTask.new(:rubocop)
|
35
|
+
|
36
|
+
desc 'Run test suite'
|
37
|
+
task ci: [:rubocop, 'engine_cart:generate'] do
|
38
|
+
SolrWrapper.wrap do |solr|
|
39
|
+
solr.with_collection do
|
40
|
+
within_test_app do
|
41
|
+
system 'RAILS_ENV=test rake blacklight_maps:index:seed'
|
42
|
+
end
|
43
|
+
Rake::Task['spec'].invoke
|
41
44
|
end
|
42
45
|
end
|
43
|
-
end
|
46
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M16,12a5.11,5.11,0,0,0,.8-1.6ZM8,12l-.8-1.6A4.72,4.72,0,0,0,8,12Z"/><path d="M12,4A5,5,0,0,0,7,9a4.71,4.71,0,0,0,.1,1c0,.13.06.26.1.39L8,12l4,8,4-8,.8-1.6L16.9,10A4.71,4.71,0,0,0,17,9,5,5,0,0,0,12,4Zm0,7a2,2,0,1,1,1.73-1A2,2,0,0,1,12,11Z"/><path d="M7.1,10c0,.13.06.26.1.39L7,10Z"/><path d="M17,10l-.19.39L16.9,10Z"/></svg>
|
@@ -5,9 +5,9 @@
|
|
5
5
|
|
6
6
|
// Configure default options and those passed via the constructor options
|
7
7
|
var options = $.extend({
|
8
|
-
tileurl : '
|
9
|
-
mapattribution : 'Map data © <a href="
|
10
|
-
|
8
|
+
tileurl : 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
|
9
|
+
mapattribution : 'Map data © <a href="https://openstreetmap.org">OpenStreetMap</a> contributors, <a' + ' href="https://creativecommons.org/licenses/by-sa/4.0/">CC-BY-SA</a>',
|
10
|
+
initialzoom: 2,
|
11
11
|
singlemarkermode: true,
|
12
12
|
searchcontrol: false,
|
13
13
|
catalogpath: 'catalog',
|
@@ -21,7 +21,7 @@
|
|
21
21
|
// Extend options from data-attributes
|
22
22
|
$.extend(options, this.data());
|
23
23
|
|
24
|
-
var mapped_items = '<span class="mapped-count"><span class="badge">' + geojson_docs.features.length + '</span> location' + (geojson_docs.features.length !== 1 ? 's' : '') + ' mapped</span>';
|
24
|
+
var mapped_items = '<span class="mapped-count"><span class="badge badge-secondary">' + geojson_docs.features.length + '</span>' + ' location' + (geojson_docs.features.length !== 1 ? 's' : '') + ' mapped</span>';
|
25
25
|
|
26
26
|
var mapped_caveat = '<span class="mapped-caveat">Only items with location data are shown below</span>';
|
27
27
|
|
@@ -31,12 +31,12 @@
|
|
31
31
|
|
32
32
|
// Update page links with number of mapped items, disable sort, per_page, pagination
|
33
33
|
if (sortAndPerPage.length) { // catalog#index and #map view
|
34
|
-
var page_links = sortAndPerPage.find('.
|
35
|
-
var result_count = page_links.find('.
|
36
|
-
page_links.html('<span class="
|
34
|
+
var page_links = sortAndPerPage.find('.page-links');
|
35
|
+
var result_count = page_links.find('.page-entries').find('strong').last().html();
|
36
|
+
page_links.html('<span class="page-entries"><strong>' + result_count + '</strong> items found</span>' + mapped_items + mapped_caveat);
|
37
37
|
sortAndPerPage.find('.dropdown-toggle').hide();
|
38
38
|
} else { // catalog#show view
|
39
|
-
|
39
|
+
$(this).before(mapped_items);
|
40
40
|
}
|
41
41
|
|
42
42
|
// determine whether to use item location or result count in cluster icon display
|
@@ -68,7 +68,6 @@
|
|
68
68
|
// Setup Leaflet map
|
69
69
|
map = L.map(this.id, {
|
70
70
|
center: [0, 0],
|
71
|
-
zoom: options.initialZoom
|
72
71
|
});
|
73
72
|
|
74
73
|
L.tileLayer(options.tileurl, {
|
@@ -120,7 +119,6 @@
|
|
120
119
|
var container = L.DomUtil.create('div', 'leaflet-bar leaflet-control');
|
121
120
|
this.link = L.DomUtil.create('a', 'leaflet-bar-part search-control', container);
|
122
121
|
this.link.title = options.searchctrlcue;
|
123
|
-
this.icon = L.DomUtil.create('i', 'glyphicon glyphicon-search', this.link);
|
124
122
|
|
125
123
|
L.DomEvent.addListener(this.link, 'click', _search);
|
126
124
|
|
@@ -147,12 +145,18 @@
|
|
147
145
|
|
148
146
|
/**
|
149
147
|
* Sets the view of the map, based off of the map bounds
|
148
|
+
* options.initialzoom is invoked for catalog#show views (unless it would obscure features)
|
150
149
|
*/
|
151
150
|
function setMapBounds() {
|
152
151
|
map.fitBounds(mapBounds(), {
|
153
152
|
padding: [10, 10],
|
154
153
|
maxZoom: options.maxzoom
|
155
154
|
});
|
155
|
+
if ($('#document').length) {
|
156
|
+
if (map.getZoom() > options.initialzoom) {
|
157
|
+
map.setZoom(options.initialzoom)
|
158
|
+
}
|
159
|
+
}
|
156
160
|
}
|
157
161
|
|
158
162
|
/**
|
@@ -182,7 +186,13 @@
|
|
182
186
|
* Checks to see if there are any features in the markers MarkerClusterGroup
|
183
187
|
*/
|
184
188
|
function hasAnyFeatures() {
|
185
|
-
|
189
|
+
var has_features = false;
|
190
|
+
markers.eachLayer(function (layer) {
|
191
|
+
if (!$.isEmptyObject(layer)) {
|
192
|
+
has_features = true;
|
193
|
+
}
|
194
|
+
});
|
195
|
+
return has_features;
|
186
196
|
}
|
187
197
|
|
188
198
|
// remove stale params, add new params, and run a new search
|