-<% cl = cycle('table0', 'table1') %>
+<%
+ changeset_data = {:id => changeset.id}
-<tr class="<%= cl %>" id="tr-changeset-<%= changeset.id%>">
+ if changeset.has_valid_bbox?
+ bbox = changeset.bbox.to_unscaled
+ changeset_data[:bbox] = {
+ :minlon => bbox.min_lon,
+ :minlat => bbox.min_lat,
+ :maxlon => bbox.max_lon,
+ :maxlat => bbox.max_lat
+ }
+ end
+%>
+
+<%= content_tag "tr", :class => cycle('table0', 'table1'), :id => "tr-changeset-#{changeset.id}", :data => {:changeset => changeset_data} do %>
<td>
<%=
id_link = link_to(changeset.id,
<%= t'changeset.changeset.no_comment' %>
<% end %>
</td>
-</tr>
+<% end %>
<script type="text/javascript">
$("#tr-changeset-<%= changeset.id%>").mouseover(function() {
var bounds = new OpenLayers.Bounds();
- <% @edits.each do |edit| %>
- <% if edit.has_valid_bbox? %>
- <% bbox = edit.bbox.to_unscaled %>
- var minlon = <%= bbox.min_lon %>;
- var minlat = <%= bbox.min_lat %>;
- var maxlon = <%= bbox.max_lon %>;
- var maxlat = <%= bbox.max_lat %>;
- var bbox = new OpenLayers.Bounds(minlon, minlat, maxlon, maxlat);
+ $("[data-changeset]").each(function () {
+ var changeset = $(this).data('changeset');
+ if (changeset.bbox) {
+ var bbox = new OpenLayers.Bounds(changeset.bbox.minlon, changeset.bbox.minlat, changeset.bbox.maxlon, changeset.bbox.maxlat);
- bounds.extend(bbox);
+ bounds.extend(bbox);
- addBoxToMap(bbox, "<%= edit.id %>", true);
- <% end %>
- <% end %>
+ addBoxToMap(bbox, changeset.id, true);
+ }
+ });
vectors.events.on({
"featureselected": function(feature) {
map.addControl(selectControl);
selectControl.activate();
- <% if ! @bbox.nil? %>
- map.zoomToExtent(proj(new OpenLayers.Bounds(<%= @bbox %>)));
- <% else %>
+ var params = OSM.mapParams();
+ if (params.bbox) {
+ map.zoomToExtent(proj(new OpenLayers.Bounds(params.minlon, params.minlat, params.maxlon, params.maxlat)));
+ } else {
map.zoomToExtent(proj(bounds));
- <% end %>
+ }
});
</script>