add correct attributions for map tiles of Heidelberg University
remove personal credentials from mapbox and refactored some code #5813 Signed-off-by: zaziemo <maren.heltsche@gmail.com>
This commit is contained in:
parent
57b7c05c4f
commit
0f3eff8f88
5 changed files with 35 additions and 32 deletions
|
|
@ -15,16 +15,18 @@ app.views.LocationStream = app.views.Content.extend({
|
|||
mapContainer.css("height", "150px");
|
||||
|
||||
if (location.lat) {
|
||||
// If the mapbox option is enabled in the defaults the mapbox tiles with the podmin's credentials are used.
|
||||
// If mapbox is not enabled the OpenMapSurfer tiles are used, which don't need credentials.
|
||||
|
||||
// If the mapbox option is enabled in the diaspora.yml, the mapbox tiles with the podmin's credentials are used.
|
||||
// If mapbox is not enabled the Maptiles from the Heidelberg University are used, which don't need credentials.
|
||||
var mapsource = gon.appConfig.map.mapbox.enabled ? gon.appConfig.map.mapbox : "";
|
||||
var tileLayerSource = mapsource ? "https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}"
|
||||
: "http://korona.geog.uni-heidelberg.de/tiles/roads/x={x}&y={y}&z={z}";
|
||||
var tileAttribution = mapsource ? "<a href='https://www.mapbox.com'>Mapbox</a>"
|
||||
: "<a href='http://korona.geog.uni-heidelberg.de/contact.html'>OpenMapSurfer</a>";
|
||||
var tileAttribution = mapsource ? "<a href='http://creativecommons.org/licenses/by-sa/2.0/''>CC-BY-SA</a>, " +
|
||||
"Imagery © <a href='https://www.mapbox.com'>Mapbox</a>"
|
||||
: "rendering <a href='http://giscience.uni-hd.de/'>" +
|
||||
"GIScience Research Group @ Heidelberg University</a>";
|
||||
var attribution = "Map data © <a href='http://openstreetmap.org'>OpenStreetMap</a> contributors, " +
|
||||
"<a href='http://creativecommons.org/licenses/by-sa/2.0/''>CC-BY-SA</a>, " +
|
||||
"Imagery © "+ tileAttribution;
|
||||
tileAttribution;
|
||||
|
||||
var map = L.map(mapContainer[0]).setView([location.lat, location.lng], 14);
|
||||
L.tileLayer(tileLayerSource, {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ app.views.SinglePostContent = app.views.Base.extend({
|
|||
"click .near-from": "toggleMap"
|
||||
},
|
||||
|
||||
templateName: 'single-post-viewer/single-post-content',
|
||||
templateName: "single-post-viewer/single-post-content",
|
||||
tooltipSelector: "time, .post_scope",
|
||||
|
||||
subviews : {
|
||||
|
|
@ -14,7 +14,7 @@ app.views.SinglePostContent = app.views.Base.extend({
|
|||
"#real-post-content" : "postContentView",
|
||||
".oembed" : "oEmbedView",
|
||||
".opengraph" : "openGraphView",
|
||||
'.poll': 'pollView',
|
||||
".poll": "pollView",
|
||||
},
|
||||
|
||||
initialize : function() {
|
||||
|
|
@ -37,16 +37,17 @@ app.views.SinglePostContent = app.views.Base.extend({
|
|||
// get location data and render map
|
||||
var location = this.model.get("location");
|
||||
|
||||
// If the mapbox option is enabled in the defaults the mapbox tiles with the podmin's credentials are used.
|
||||
// If mapbox is not enabled the OpenMapSurfer tiles are used, which don't need credentials.
|
||||
// If the mapbox option is enabled in the diaspora.yml, the mapbox tiles with the podmin's credentials are used.
|
||||
// If mapbox is not enabled the Maptiles from the Heidelberg University are used, which don't need credentials.
|
||||
var mapsource = gon.appConfig.map.mapbox.enabled ? gon.appConfig.map.mapbox : "";
|
||||
var tileLayerSource = mapsource ? "https://api.tiles.mapbox.com/v4/{id}/{z}/{x}/{y}.png?access_token={accessToken}"
|
||||
: "http://korona.geog.uni-heidelberg.de/tiles/roads/x={x}&y={y}&z={z}";
|
||||
var tileAttribution = mapsource ? "<a href='https://www.mapbox.com'>Mapbox</a>"
|
||||
: "<a href='http://korona.geog.uni-heidelberg.de/contact.html'>OpenMapSurfer</a>";
|
||||
var tileAttribution = mapsource ? "<a href='http://creativecommons.org/licenses/by-sa/2.0/''>CC-BY-SA</a>, " +
|
||||
"Imagery © <a href='https://www.mapbox.com'>Mapbox</a>"
|
||||
: "rendering <a href='http://giscience.uni-hd.de/'>" +
|
||||
"GIScience Research Group @ Heidelberg University</a>";
|
||||
var attribution = "Map data © <a href='http://openstreetmap.org'>OpenStreetMap</a> contributors, " +
|
||||
"<a href='http://creativecommons.org/licenses/by-sa/2.0/''>CC-BY-SA</a>, " +
|
||||
"Imagery © "+ tileAttribution;
|
||||
tileAttribution;
|
||||
|
||||
var map = L.map(mapContainer[0]).setView([location.lat, location.lng], 14);
|
||||
L.tileLayer(tileLayerSource, {
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ defaults:
|
|||
enabled: true
|
||||
mapbox:
|
||||
enabled: false
|
||||
id: "zaziemo.mpn66kn8"
|
||||
access_token: "pk.eyJ1IjoiemF6aWVtbyIsImEiOiI3ODVjMzVjNmM2ZTU3YWM3YTE5YWYwMTRhODljM2M1MSJ9.-nVgyS4PLnV4m9YkvMB5wA"
|
||||
id:
|
||||
access_token:
|
||||
privacy:
|
||||
jquery_cdn: false
|
||||
google_analytics_key:
|
||||
|
|
|
|||
|
|
@ -334,9 +334,9 @@ configuration: ## Section
|
|||
## and access_token.
|
||||
map: ##Section
|
||||
|
||||
# enable: false
|
||||
# enabled: true
|
||||
# mapbox:
|
||||
# enable: false
|
||||
# enabled: false
|
||||
# id: 'your.id'
|
||||
# access_token: 'youraccesstoken'
|
||||
|
||||
|
|
|
|||
|
|
@ -292,24 +292,24 @@ describe Reshare, type: :model do
|
|||
end
|
||||
|
||||
describe "#post_location" do
|
||||
let(:status_message) { build(:status_message, text: "This is a status_message", author: bob.person, public: true) }
|
||||
let(:reshare) { create(:reshare, root: status_message) }
|
||||
let(:status_message) { build(:status_message, text: "This is a status_message", author: bob.person, public: true) }
|
||||
let(:reshare) { create(:reshare, root: status_message) }
|
||||
|
||||
context "with location" do
|
||||
let(:location) { build(:location) }
|
||||
context "with location" do
|
||||
let(:location) { build(:location) }
|
||||
|
||||
it "should deliver address and coordinates" do
|
||||
status_message.location = location
|
||||
expect(reshare.post_location).to include(address: location.address, lat: location.lat, lng: location.lng)
|
||||
end
|
||||
it "should deliver address and coordinates" do
|
||||
status_message.location = location
|
||||
expect(reshare.post_location).to include(address: location.address, lat: location.lat, lng: location.lng)
|
||||
end
|
||||
end
|
||||
|
||||
context "without location" do
|
||||
it "should deliver empty address and coordinates" do
|
||||
expect(reshare.post_location[:address]).to be_nil
|
||||
expect(reshare.post_location[:lat]).to be_nil
|
||||
expect(reshare.post_location[:lng]).to be_nil
|
||||
end
|
||||
context "without location" do
|
||||
it "should deliver empty address and coordinates" do
|
||||
expect(reshare.post_location[:address]).to be_nil
|
||||
expect(reshare.post_location[:lat]).to be_nil
|
||||
expect(reshare.post_location[:lng]).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue