From: Tom Hughes Date: Sun, 1 May 2011 21:52:58 +0000 (+0100) Subject: Tidy up code for adding a map to the changeset list page X-Git-Tag: live~6859^2~23 X-Git-Url: https://git.openstreetmap.org./rails.git/commitdiff_plain/1635c165608b9619f0b04eba508351afc3602292 Tidy up code for adding a map to the changeset list page --- diff --git a/app/views/changeset/_changeset.html.erb b/app/views/changeset/_changeset.html.erb index 2ba88b756..b06dd05a3 100644 --- a/app/views/changeset/_changeset.html.erb +++ b/app/views/changeset/_changeset.html.erb @@ -1,6 +1,6 @@ <% cl = cycle('table0', 'table1') %> - + <%= id_link = link_to(changeset.id, @@ -52,3 +52,13 @@ <% end %> + + diff --git a/app/views/changeset/_changeset_map_add.html.erb b/app/views/changeset/_changeset_map_add.html.erb deleted file mode 100644 index 924408153..000000000 --- a/app/views/changeset/_changeset_map_add.html.erb +++ /dev/null @@ -1,8 +0,0 @@ - var minlon = <%= changeset_map_add.min_lon / GeoRecord::SCALE.to_f %>; - var minlat = <%= changeset_map_add.min_lat / GeoRecord::SCALE.to_f %>; - var maxlon = <%= changeset_map_add.max_lon / GeoRecord::SCALE.to_f %>; - var maxlat = <%= changeset_map_add.max_lat / GeoRecord::SCALE.to_f %>; - var bbox = new OpenLayers.Bounds(minlon, minlat, maxlon, maxlat); - - bounds.extend(bbox); - box = addBoxToMap(bbox, {name: "changeset-<%= changeset_map_add.id %>"}, true); diff --git a/app/views/changeset/_map.html.erb b/app/views/changeset/_map.html.erb index ddfac9f54..605eacf15 100644 --- a/app/views/changeset/_map.html.erb +++ b/app/views/changeset/_map.html.erb @@ -1,74 +1,80 @@ <%= javascript_include_tag '/openlayers/OpenLayers.js' %> <%= javascript_include_tag '/openlayers/OpenStreetMap.js' %> <%= javascript_include_tag 'map.js' %> +
<%= t 'browse.map.loading' %>
+ diff --git a/public/javascripts/map.js b/public/javascripts/map.js index df9d30992..66ed9e909 100644 --- a/public/javascripts/map.js +++ b/public/javascripts/map.js @@ -149,7 +149,7 @@ function addObjectToMap(url, zoom, callback) { layer.loadGML(); } -function addBoxToMap(boxbounds, attributes, line) { +function addBoxToMap(boxbounds, id, outline) { if (!vectors) { // Be aware that IE requires Vector layers be initialised on page load, and not under deferred script conditions vectors = new OpenLayers.Layer.Vector("Boxes", { @@ -157,20 +157,20 @@ function addBoxToMap(boxbounds, attributes, line) { }); map.addLayer(vectors); } - var geometry; - if (line) { + if (outline) { vertices = boxbounds.toGeometry().getVertices(); - vertices.push( new OpenLayers.Geometry.Point( vertices[0].x, vertices[0].y ) ); + vertices.push(new OpenLayers.Geometry.Point(vertices[0].x, vertices[0].y)); geometry = new OpenLayers.Geometry.LineString(vertices).transform(epsg4326, map.getProjectionObject()); } else { geometry = boxbounds.toGeometry().transform(epsg4326, map.getProjectionObject()); - } - var box = new OpenLayers.Feature.Vector(geometry, attributes, { + } + var box = new OpenLayers.Feature.Vector(geometry, {}, { strokeWidth: 2, strokeColor: '#ee9900', fillOpacity: 0 }); + box.fid = id; vectors.addFeatures(box); diff --git a/public/stylesheets/common.css b/public/stylesheets/common.css index 098a9ddd9..38cfec423 100644 --- a/public/stylesheets/common.css +++ b/public/stylesheets/common.css @@ -611,6 +611,10 @@ hr { white-space: nowrap; } +#changeset_list .selected { + background-color: #ffff55; +} + /* Rules for the data browser */ #browse_navigation {