X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/d3314fee0f4a4031a893e0a93b5fa0f86b1613ed..e6de9accd215774a104497a7390943c9fa890a8b:/app/views/browse/start.rjs diff --git a/app/views/browse/start.rjs b/app/views/browse/start.rjs index 0d8b3288c..8d221f290 100644 --- a/app/views/browse/start.rjs +++ b/app/views/browse/start.rjs @@ -1,40 +1,59 @@ -page.replace_html :sidebar_title, 'Browse' +page.replace_html :sidebar_title, 'Data' page.replace_html :sidebar_content, :partial => 'start' page << <= 15) { + useMap(); + } else { + $("status").innerHTML = "Zoom in or Select an area of the map to view."; + } } function stopBrowse() { - if (gml) { - gml.destroy(); - gml = null; - } - if (sf) { - sf.destroy(); - sf = null; - } - if (currentFeature) { - currentFeature.destroy(); - currentFeature = null; - } + if (browsing) { + browsing = false; + map.dataLayer.stopBrowse = null; + if (gml) { + gml.destroy(); + gml = null; + } + if (sf) { + sf.destroy(); + sf = null; + } + if (currentFeature) { + currentFeature.destroy(); + currentFeature = null; + } + map.dataLayer.setVisibility(false); + map.events.unregister("moveend", map, showData); + } } function startDrag() { @@ -46,28 +65,102 @@ page << < 0.25) { + $("status").innerHTML = "Unable to load: Bounding box size of " + size + " is too large. (Must be smaller than 0.25)
"; + return; + } + var url = "/api/0.5/map?bbox="+bounds.toBBOX(); + loadGML(url); + } + function loadGML(url) { + $("status").innerHTML = "Loading..."; + $("object").innerHTML = ""; if (!gml) { - var def = OpenLayers.Feature.Vector.style['default']; var style = new OpenLayers.Style(); style.addRules([new OpenLayers.Rule( {'symbolizer': @@ -78,21 +171,28 @@ page << <API)"; objList = document.createElement("ul"); @@ -130,7 +230,9 @@ page << <= 0; i--) { + var user = nodes[i].getAttribute("user") || "private user"; + var timestamp = nodes[i].getAttribute("timestamp"); + var item = document.createElement("li"); + item.appendChild(document.createTextNode("Edited by " + user + " at " + timestamp)); + history.appendChild(item); + } + div.appendChild(history); + var link = document.createElement("a"); + link.appendChild(document.createTextNode("History")); + link.href = "/browse/"+this.type+"/"+this.feature.osm_id+"/history"; + div.appendChild(link); + $("object").appendChild(div); + } + start(); EOJ