aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStruan Donald <struan@exo.org.uk>2018-04-04 12:28:34 +0100
committerDave Arter <davea@mysociety.org>2018-04-10 10:42:34 +0100
commitf94eb50f9a33e89364f674da3d0af2fb329947b0 (patch)
treed65abc41ff6fd358c36752dc4d5be637db405883
parent68a5ed303f0c74b4ed784bf98930499857e52017 (diff)
Add layer attribution to attribution control
If a layer has an attribution option then add it to the attribution control when the layer becomes visible.
-rw-r--r--CHANGELOG.md1
-rw-r--r--templates/web/base/maps/osm.html1
-rw-r--r--web/cobrands/fixmystreet/assets.js3
-rw-r--r--web/js/map-OpenStreetMap.js1
4 files changed, 6 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d5f650411..50a3f18de 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -22,6 +22,7 @@
- Asset layers can be attached to more than one category each. #2049
- Cobrands hook to remove phone number field. #2049
- Check recent reports for any hidden since cached. #2053
+ - Asset layer attribution automatically shown. #2061
- Bugfixes:
- Stop asset layers obscuring marker layer. #1999
- Don't delete hidden field values when inspecting reports. #1999
diff --git a/templates/web/base/maps/osm.html b/templates/web/base/maps/osm.html
index 51c3ad388..70d05929f 100644
--- a/templates/web/base/maps/osm.html
+++ b/templates/web/base/maps/osm.html
@@ -1,3 +1,4 @@
[%
+map.copyright = ''; # This is handled with OpenLayers.Control.Attribution
map_html = INCLUDE maps/openlayers.html
%]
diff --git a/web/cobrands/fixmystreet/assets.js b/web/cobrands/fixmystreet/assets.js
index 6c64bb922..57c82a46b 100644
--- a/web/cobrands/fixmystreet/assets.js
+++ b/web/cobrands/fixmystreet/assets.js
@@ -475,6 +475,9 @@ fixmystreet.assets = {
styleMap: options.stylemap || get_asset_stylemap(),
assets: true
};
+ if (options.attribution !== undefined) {
+ layer_options.attribution = options.attribution;
+ }
if (options.srsName !== undefined) {
layer_options.projection = new OpenLayers.Projection(options.srsName);
} else if (fixmystreet.wmts_config) {
diff --git a/web/js/map-OpenStreetMap.js b/web/js/map-OpenStreetMap.js
index a742e61ba..4165f8ee4 100644
--- a/web/js/map-OpenStreetMap.js
+++ b/web/js/map-OpenStreetMap.js
@@ -5,6 +5,7 @@ fixmystreet.maps.config = function() {
}
fixmystreet.controls = [
new OpenLayers.Control.ArgParser(),
+ new OpenLayers.Control.Attribution(),
//new OpenLayers.Control.LayerSwitcher(),
new OpenLayers.Control.Navigation(),
new OpenLayers.Control.PermalinkFMS(permalink_id),