Skip to content

Commit

Permalink
make Cartodb the default postiron basemap
Browse files Browse the repository at this point in the history
  • Loading branch information
mejackreed committed Jul 5, 2016
1 parent 8d5494a commit 5fbbd8a
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 22 deletions.
9 changes: 0 additions & 9 deletions app/assets/javascripts/geoblacklight/basemaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,6 @@ GeoBlacklight.Basemaps = {
detectRetina: true
}
),
mapquest: L.tileLayer(
'https://otile{s}-s.mqcdn.com/tiles/1.0.0/map/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://openstreetmap.org">OpenStreetMap</a> contributors, Tiles Courtesy of <a href="http://www.mapquest.com/" target="_blank">MapQuest</a> <img src="//developer.mapquest.com/content/osm/mq_logo.png" alt="">',
maxZoom: 18,
worldCopyJump: true,
subdomains: '1234', // see http://developer.mapquest.com/web/products/open/map
detectRetina: true
}
),
positron: L.tileLayer(
'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png', {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, &copy; <a href="http://cartodb.com/attributions">CartoDB</a>',
Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/geoblacklight/viewers/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ GeoBlacklight.Viewer.Map = GeoBlacklight.Viewer.extend({
if (_this.data.basemap) {
return GeoBlacklight.Basemaps[_this.data.basemap];
} else {
return _this.basemap.mapquest;
return _this.basemap.positron;
}
}
});
2 changes: 1 addition & 1 deletion app/helpers/geoblacklight_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def render_value_as_truncate_abstract(args)
# Selects the basemap used for map displays
# @return [String]
def geoblacklight_basemap
blacklight_config.basemap_provider || 'mapquest'
blacklight_config.basemap_provider || 'positron'
end

##
Expand Down
3 changes: 1 addition & 2 deletions lib/generators/geoblacklight/templates/catalog_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,9 @@ class CatalogController < ApplicationController
# Configure basemap provider for GeoBlacklight maps (uses https only basemap
# providers with open licenses)
# Valid basemaps include:
# 'mapquest' http://developer.mapquest.com/web/products/open/map
# 'positron' http://cartodb.com/basemaps/
# 'darkMatter' http://cartodb.com/basemaps/
config.basemap_provider = 'mapquest'
config.basemap_provider = 'positron'
end


Expand Down
17 changes: 9 additions & 8 deletions spec/features/configurable_basemap_spec.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,27 @@
require 'spec_helper'

feature 'Configurable basemap', js: true do
scenario 'defaults to mapquest' do
scenario 'defaults to positron' do
visit root_path
expect(page).to have_css "img[src*='mqcdn.com']"
expect(page).to have_css "img[src*='cartodb']"
end
feature 'without provided basemap config' do
before do
CatalogController.blacklight_config.basemap_provider = nil
end
scenario 'has mapquest map' do
scenario 'has CartoDB map' do
visit root_path
expect(page).to have_css "img[src*='mqcdn.com']"
expect(page).to have_css "img[src*='cartodb']"
end
end
feature 'using positron' do
feature 'using darkMatter' do
before do
CatalogController.blacklight_config.basemap_provider = 'positron'
CatalogController.blacklight_config.basemap_provider = 'darkMatter'
end
scenario 'has positron map' do
scenario 'has darkMatter map' do
puts CatalogController.blacklight_config.basemap_provider
visit root_path
expect(page).to have_css "img[src*='light_all']"
expect(page).to have_css "img[src*='dark_all']"
end
end
end
2 changes: 1 addition & 1 deletion spec/helpers/geoblacklight_helpers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
let(:blacklight_config) { double }
it 'without configuration' do
expect(blacklight_config).to receive(:basemap_provider).and_return(nil)
expect(geoblacklight_basemap).to eq 'mapquest'
expect(geoblacklight_basemap).to eq 'positron'
end
it 'with custom configuration' do
expect(blacklight_config).to receive(:basemap_provider).and_return('positron')
Expand Down

0 comments on commit 5fbbd8a

Please sign in to comment.