]> git.openstreetmap.org Git - rails.git/blobdiff - app/views/browse/start.rjs
Include node coordinates on the data browser view for a node. Fixes #1856.
[rails.git] / app / views / browse / start.rjs
index f22796afeb81d98576361c5158784bd367518ade..1cf423163f7e2b08ef274e7d5572226348bfe3f5 100644 (file)
@@ -15,6 +15,8 @@ page << <<EOJ
   OpenLayers.Feature.Vector.style['default'].cursor = "pointer";
     
   function startBrowse() {
+    browseActive = true;
+
     openSidebar({ onclose: stopBrowse });
 
     var vectors = new OpenLayers.Layer.Vector();
@@ -32,8 +34,6 @@ page << <<EOJ
 
     map.events.register("moveend", map, showData);
     map.events.triggerEvent("moveend");
-
-    browseActive = true;
   }
 
   function showData() {
@@ -50,11 +50,6 @@ page << <<EOJ
     if (browseActive) {
       browseActive = false;
 
-      if (browseDataLayer) {
-        browseDataLayer.destroy();
-        browseDataLayer = null; 
-      } 
-
       if (browseSelectControl) {   
         browseSelectControl.destroy();  
         browseSelectControl = null;
@@ -70,6 +65,11 @@ page << <<EOJ
         browseActiveFeature = null; 
       }
 
+      if (browseDataLayer) {
+        browseDataLayer.destroy();
+        browseDataLayer = null; 
+      } 
+
       map.dataLayer.setVisibility(false);
       map.events.unregister("moveend", map, showData);
     }    
@@ -153,7 +153,7 @@ page << <<EOJ
     return false;
   }    
 
-  function customDataLoader(request) { 
+  function customDataLoader(request) {
     if (browseActive) {
       var doc = request.responseXML;
 
@@ -189,7 +189,7 @@ page << <<EOJ
     if (size > 0.25) {
       setStatus("Unable to load: Bounding box size of " + size + " is too large (must be smaller than 0.25)");
     } else {
-      loadGML("/api/0.5/map?bbox=" + projected.toBBOX());
+      loadGML("/api/#{API_VERSION}/map?bbox=" + projected.toBBOX());
     }
   }
 
@@ -210,7 +210,10 @@ page << <<EOJ
 
       browseDataLayer = new OpenLayers.Layer.GML("Data", url, {
         format: OpenLayers.Format.OSM,
-        formatOptions: { checkTags: true },
+        formatOptions: {
+          checkTags: true, 
+          interestingTagsExclude: ['source','source_ref','source:ref','history','attribution','created_by','tiger:county','tiger:tlid','tiger:upload_uuid']
+        },
         maxFeatures: 100,
         requestSuccess: customDataLoader,
         displayInLayerSwitcher: false,
@@ -223,8 +226,8 @@ page << <<EOJ
       map.addLayer(browseDataLayer);
             
       browseSelectControl = new OpenLayers.Control.SelectFeature(browseDataLayer, { onSelect: onFeatureSelect });
-      browseSelectControl.handler.stopDown = false;
-      browseSelectControl.handler.stopUp = false;
+      browseSelectControl.handlers.feature.stopDown = false;
+      browseSelectControl.handlers.feature.stopUp = false;
       map.addControl(browseSelectControl);
       browseSelectControl.activate();
     } else {
@@ -393,7 +396,7 @@ page << <<EOJ
     this.link.href = "";
     this.link.innerHTML = "Wait...";
 
-    new Ajax.Request("/api/0.5/" + this.type + "/" + this.feature.osm_id + "/history", {
+    new Ajax.Request("/api/#{API_VERSION}/" + this.type + "/" + this.feature.osm_id + "/history", {
       onComplete: OpenLayers.Function.bind(displayHistory, this)
     });