Don't show map controls on browse pages
authorJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 12 Oct 2012 20:28:16 +0000 (13:28 -0700)
committerJohn Firebaugh <john.firebaugh@gmail.com>
Fri, 9 Nov 2012 20:59:27 +0000 (12:59 -0800)
app/assets/javascripts/browse.js
app/assets/javascripts/map.js.erb

index 995f0d12d07c7af1d74c85dd672af69e1332da53..0a37627273a82067e41b55bfdf8e03a4f8ec1806 100644 (file)
@@ -21,7 +21,11 @@ $(document).ready(function () {
     return false;
   }
 
-  var map = createMap("small_map");
+  var map = createMap("small_map", {
+    layerControl: false,
+    zoomControl: false,
+    attributionControl: false
+  });
 
   var params = $("#small_map").data();
   if (params.type == "changeset") {
index eae9b89529fcca1206d2b26d9a2d1a7cfc85cc33..2e72046d1e677e38af0357b68004db74b1f5378d 100644 (file)
@@ -76,12 +76,18 @@ var layers = [
   }
 ];
 
-function createMap(divName) {
-  map = L.map(divName);
+function createMap(divName, options) {
+  map = L.map(divName, options);
 
-  map.attributionControl.setPrefix(''); // For tmcw
+  if (map.attributionControl) {
+    map.attributionControl.setPrefix(''); // For tmcw
+  }
+
+  var layersControl = L.control.layers();
 
-  var layersControl = L.control.layers().addTo(map);
+  if (!options || options.layerControl !== false) {
+    layersControl.addTo(map);
+  }
 
   for (var i = 0; i < layers.length; i++) {
     layers[i].layer = L.tileLayer(layers[i].urlTemplate, layers[i]);