<%= javascript_include_tag '/openlayers/OpenLayers.js' %>
<%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
<%= javascript_include_tag 'map.js' %>
-<td align="right">
- <% if map.instance_of? Changeset or map.visible %>
- <div id="small_map" style="width:250px; height: 300px; border: solid 1px black">
- </div>
- <span id="loading"><%= t 'browse.map.loading' %></span>
- <a id="area_larger_map" href=""></a>
- <% unless map.instance_of? Changeset %>
- <br />
- <a id="object_larger_map" href=""></a>
- <% end %>
+<div id="browse_map">
+ <% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %>
+ <div id="small_map">
+ </div>
+ <span id="loading"><%= t 'browse.map.loading' %></span>
+ <a id="area_larger_map" href=""></a>
+ <% unless map.instance_of? Changeset %>
+ <br />
+ <a id="object_larger_map" href=""></a>
+ <% end %>
<% else %>
<%= t 'browse.map.deleted' %>
<% end %>
-</td>
-<% if map.instance_of? Changeset or map.visible %>
+</div>
+<% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %>
<script type="text/javascript">
OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
$("area_larger_map").href = '/?minlon='+minlon+'&minlat='+minlat+'&maxlon='+maxlon+'&maxlat='+maxlat+'&box=yes';
$("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
+ <% else if map.instance_of? MapBug %>
+ $("loading").innerHTML = "";
+ var centre = new OpenLayers.LonLat(<%= map.lon %>, <%= map.lat %>);
+ var zoom = 16;
+ setMapCenter(centre, zoom);
+ marker = addMarkerToMap(centre);
+ $("area_larger_map").href = '/?mlon=<%= map.lon %>&mlat=<%=map.lat %>';
+ $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
<% else %>
var obj_type = "<%= map.class.name.downcase %>";
var obj_id = <%= map.id %>;
+ var obj_version = <%= map.version %>;
+ var obj_visible = <%= map.visible %>;
var url = "/api/<%= "#{API_VERSION}" %>/<%= map.class.name.downcase %>/<%= map.id %>";
if (obj_type != "node") {
url += "/full";
+ } else if (!obj_visible) {
+ var previous_version = obj_version - 1;
+ url += "/" + previous_version;
}
addObjectToMap(url, true, function(extent) {
$("small_map").style.display = "none";
}
});
- <% end %>
+ <% end end %>
}
window.onload = init;