end
hash
end
+
+ # Pretend we're not in any ways
+ def ways
+ return []
+ end
+
+ # Pretend we're not in any relations
+ def containing_relation_members
+ return []
+ end
end
el1 << e
end
return el1
- end
+ end
+
+ # Temporary method to match interface to nodes
+ def tags_as_hash
+ return self.tags
+ end
+
+ # Temporary method to match interface to relations
+ def relation_members
+ return self.old_members
+ end
+
+ # Pretend we're not in any relations
+ def containing_relation_members
+ return []
+ end
end
el1 << e
end
return el1
- end
+ end
+
+ # Temporary method to match interface to nodes
+ def tags_as_hash
+ return self.tags
+ end
+
+ # Temporary method to match interface to ways
+ def way_nodes
+ return self.old_nodes
+ end
+
+ # Pretend we're not in any relations
+ def containing_relation_members
+ return []
+ end
end
return false
end
+ # Temporary method to match interface to nodes
+ def tags_as_hash
+ return self.tags
+ end
end
self.delete_with_relations_and_history(user)
end
+
+ # Temporary method to match interface to nodes
+ def tags_as_hash
+ return self.tags
+ end
end
+++ /dev/null
-<% if obj.visible %>
-<%= render :partial => 'map', :locals => { :type => type, :id => obj.id } %>
-<% else %>
-Deleted
-<% end %>
-<ul>
-<% if obj.visible %>
-<li><%= link_to h("API"), :controller => type, :action => "read", :id => obj.id %></li>
-<% end %>
-<li><%= link_to h("History"), :controller => "old_" + type, :action => "history", :id => obj.id %>
- (<%= link_to h("HTML"), :action => type+"_history", :id => obj.id %>)</li>
-</ul>
-<%= render :partial => 'common_editedby', :locals => { :obj => obj } %>
--- /dev/null
+<tr>
+ <th>Edited at:</th>
+ <td><%= h(common_details.timestamp) %></td>
+</tr>
+
+<% if common_details.user.data_public %>
+ <tr>
+ <th>Edited by:</th>
+ <td><%= link_to h(common_details.user.display_name), :controller => "user", :action => "view", :display_name => common_details.user.display_name %></td>
+ </tr>
+<% end %>
+
+<% unless common_details.tags_as_hash.empty? %>
+ <tr valign="top">
+ <th>Tags:</th>
+ <td>
+ <table padding="0">
+ <%= render :partial => "tag", :collection => common_details.tags_as_hash %>
+ </table>
+ </td>
+ </tr>
+<% end %>
+++ /dev/null
-Last edited: <%= h(obj.timestamp) %>
-<% if obj.user.data_public %>
-by <%= link_to h(obj.user.display_name), :controller => 'user', :action => 'view' , :display_name => obj.user.display_name %>
-<% end %>
--- /dev/null
+<tr>
+ <td>
+ <%= link_to "Relation " + containing_relation.id.to_s, :action => "relation", :id => containing_relation.id.to_s %>
+ <% unless containing_relation.member_role.blank? %>
+ (as <%= h(containing_relation.member_role) %>)
+ <% end %>
+ </td>
+</tr>
<%= javascript_include_tag '/openlayers/OpenLayers.js' %>
<%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
<%= javascript_include_tag 'map.js' %>
-<div style="float:right">
<div id="small_map" style="width:250px; height: 300px; border: solid 1px black">
</div>
+<span id="loading">Loading...</span>
+<a id="larger_map" href=""></a>
<script type="text/javascript">
function init() {
- var obj_type = '<%= type %>';
- var obj_id = <%= id %>;
- var url = "/api/<%= "#{API_VERSION}" %>/<%= type %>/<%= id %>";
- if (obj_type != "node") {
- url += "/full";
- }
- var map = createMap('small_map', {controls: [new OpenLayers.Control.Navigation()]});
- var osm_layer = new OpenLayers.Layer.GML("OSM", url, {format: OpenLayers.Format.OSM, projection: new OpenLayers.Projection("EPSG:4326")});
- osm_layer.events.register("loadend", osm_layer, function() {
- $("loading").innerHTML = "";
- if (this.features.length) {
+ var obj_type = "<%= type %>";
+ var obj_id = <%= id %>;
+ var url = "/api/<%= "#{API_VERSION}" %>/<%= type %>/<%= id %>";
+
+ if (obj_type != "node") {
+ url += "/full";
+ }
+
+ var map = createMap("small_map", {
+ controls: [ new OpenLayers.Control.Navigation() ]
+ });
+
+ var osm_layer = new OpenLayers.Layer.GML("OSM", url, {
+ format: OpenLayers.Format.OSM,
+ projection: new OpenLayers.Projection("EPSG:4326")
+ });
+
+ osm_layer.events.register("loadend", osm_layer, function() {
+ $("loading").innerHTML = "";
+
+ if (this.features.length) {
var extent = this.features[0].geometry.getBounds();
+
for (var i = 1; i < this.features.length; i++) {
- extent.extend(this.features[i].geometry.getBounds());
+ extent.extend(this.features[i].geometry.getBounds());
}
+
if (extent) {
- this.map.zoomToExtent(extent);
+ this.map.zoomToExtent(extent);
} else {
- this.map.zoomToMaxExtent();
+ this.map.zoomToMaxExtent();
}
+
var center = getMapCenter();
$("larger_map").href = '/?lat='+center.lat+'&lon='+center.lon+'&zoom='+this.map.getZoom();
$("larger_map").innerHTML = "View Larger Map";
- } else {
+ } else {
$("small_map").style.display = "none";
- }
- })
- map.addLayer(osm_layer);
- osm_layer.loadGML();
- osm_layer.loaded = true;
-}
-window.onload = init;
+ }
+ });
+
+ map.addLayer(osm_layer);
+
+ osm_layer.loadGML();
+ osm_layer.loaded = true;
+ }
+
+ window.onload = init;
</script>
-<span id="loading">Loading...</span>
-<a id="larger_map" href=""></a>
-</div>
+++ /dev/null
-<tr>
- <td><%= link_to member.member_id.to_s, :action => member.member_type, :id => member.member_id %></td>
- <td><%= h(member.member_type) %></td>
- <td><%= h(member.member_role) %></td>
-</tr>
<div style="float:right; text-align:center; width: 250px;">
-<% if @prev %>
-<
-<%= link_to @prev.id.to_s, :action => type, :id => @prev.id %>
-<% end %>
-<% if @prev and @next %>
-|
-<% end %>
-<% if @next %>
-<%= link_to @next.id.to_s, :action => type, :id => @next.id %>
->
-<% end %>
+ <% if @prev %>
+ <
+ <%= link_to @prev.id.to_s, :id => @prev.id %>
+ <% end %>
+ <% if @prev and @next %>
+ |
+ <% end %>
+ <% if @next %>
+ <%= link_to @next.id.to_s, :id => @next.id %>
+ >
+ <% end %>
</div>
--- /dev/null
+<table>
+
+ <%= render :partial => "common_details", :object => node_details %>
+
+ <% unless node_details.ways.empty? and node_details.containing_relation_members.empty? %>
+ <tr valign="top">
+ <th>Part of:</th>
+ <td>
+ <table padding="0">
+ <% node_details.ways.each do |way| %>
+ <tr><td><%= link_to "Way " + way.id.to_s, :action => "way", :id => way.id.to_s %></td></tr>
+ <% end %>
+ <%= render :partial => "containing_relation", :collection => node_details.containing_relation_members %>
+ </table>
+ </td>
+ </tr>
+ <% end %>
+
+</table>
--- /dev/null
+<table>
+
+ <%= render :partial => "common_details", :object => relation_details %>
+
+ <% unless relation_details.relation_members.empty? %>
+ <tr valign="top">
+ <th>Members:</th>
+ <td>
+ <table padding="0">
+ <%= render :partial => "relation_member", :collection => relation_details.relation_members %>
+ </table>
+ </td>
+ </tr>
+ <% end %>
+
+ <% unless relation_details.containing_relation_members.empty? %>
+ <tr>
+ <th>Part of:</th>
+ <td>
+ <table padding="0">
+ <%= render :partial => "containing_relation", :collection => relation_details.containing_relation_members %>
+ </table>
+ </td>
+ </tr>
+ <% end %>
+
+</table>
--- /dev/null
+<tr>
+ <td>
+ <%= h(relation_member.member_type.capitalize) %>
+ <%= link_to relation_member.member_id.to_s, :action => relation_member.member_type, :id => relation_member.member_id %>
+ <% unless relation_member.member_role.blank? %>
+ as
+ <%= h(relation_member.member_role) %>
+ <% end %>
+ </td>
+</tr>
+++ /dev/null
-<% if members.length != 0 %>
-<h3>Members</h3>
-<table id="keyvalue" cellpadding="3">
- <tr>
- <th>ID</th>
- <th>Type</th>
- <th>Role</th>
- </tr>
- <%= render :partial => 'member', :collection => members %>
-</table>
-<% end %>
<tr>
- <td><%= h(tag[0]) %></td><td><%= h(tag[1]) %></td>
+ <td><%= h(tag[0]) %> = <%= h(tag[1]) %></td>
</tr>
-
+++ /dev/null
-<% if tags.length != 0 %>
-<h3>Tags</h3>
-<table id="keyvalue" cellpadding="3">
- <tr>
- <th>Key</th>
- <th>Value</th>
- </tr>
- <%= render :partial => 'tag', :collection => tags %>
-</table>
-<% end %>
--- /dev/null
+<table>
+
+ <%= render :partial => "common_details", :object => way_details %>
+
+ <tr valign="top">
+ <th>Nodes:</th>
+ <td>
+ <table padding="0">
+ <% way_details.way_nodes.each do |wn| %>
+ <tr><td><%= link_to "Node " + wn.node_id.to_s, :action => "node", :id => wn.node_id.to_s %></td></tr>
+ <% end %>
+ </table>
+ </td>
+ </tr>
+
+ <% unless way_details.containing_relation_members.empty? %>
+ <tr>
+ <th>Part of:</th>
+ <td>
+ <table padding="0">
+ <%= render :partial => "containing_relation", :collection => way_details.containing_relation_members %>
+ </table>
+ </td>
+ </tr>
+ <% end %>
+
+</table>
-<%= render :partial => 'navigation', :locals => { :type => "node" } %>
-<h2>Node Browser: <%= h(@name) %></h2>
-<%= render :partial => 'common', :locals => { :obj => @node, :type => "node" } %>
-<%= render :partial => 'tag_table', :locals => { :tags => @node.tags_as_hash } %>
-<% if @node.ways.length != 0 %>
- <br style="clear:both" />
- <div style="float:right; width: 250px;">
- <h2>Part of:</h2>
- <ul>
- <% @node.ways.each do |way| %>
- <li> <%= link_to "Way " + way.id.to_s, :action => "way", :id => way.id.to_s %> </li>
- <% end %>
- </ul>
- </div>
-<% end %>
+<table width="100%">
+ <tr>
+ <td>
+ <h2>Node: <%= h(@name) %></h2>
+ </td>
+ <td>
+ <%= render :partial => "navigation" %>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <%= render :partial => "node_details", :object => @node %>
+ <hr />
+ <%= link_to "Download XML", :controller => "node", :action => "read" %>
+ or
+ <%= link_to "view history", :action => "node_history" %>
+ </td>
+ <td align="right">
+ <% if @node.visible %>
+ <%= render :partial => "map", :locals => { :type => "node", :id => @node.id } %>
+ <% else %>
+ Deleted
+ <% end %>
+ </td>
+ </tr>
+</table>
<h2>Node History: <%= h(@name) %></h2>
-<%= render :partial => 'common', :locals => { :obj => @node, :type => "node" } %>
-<h2>Hisorical Versions</h2>
-<% @node.old_nodes.reverse.each do |node| %>
-<%= render :partial => 'common_editedby', :locals => { :obj => node } %>
-<%= render :partial => 'tag_table', :locals => { :tags => node.tags_as_hash } %>
-<hr />
-<% end %>
+
+<table width="100%">
+ <tr valign="top">
+ <td>
+ <% @node.old_nodes.reverse.each do |node| %>
+ <%= render :partial => "node_details", :object => node %>
+ <hr />
+ <% end %>
+ <%= link_to "Download XML", :controller => "old_node", :action => "history" %>
+ or
+ <%= link_to "view details", :action => "node" %>
+ </td>
+ <td align="right">
+ <% if @node.visible %>
+ <%= render :partial => "map", :locals => { :type => "node", :id => @node.id } %>
+ <% else %>
+ Deleted
+ <% end %>
+ </td>
+ </tr>
+</table>
-<%= render :partial => 'navigation', :locals => { :type => "relation" } %>
-<h2>Relation Browser: <%= h(@name) %></h2>
-<%= render :partial => 'common', :locals => { :obj => @relation, :type => "relation" } %>
-<%= render :partial => 'tag_table', :locals => { :tags => @relation.tags } %>
-<%= render :partial => 'relation_members', :locals => { :members => @relation.relation_members } %>
+<table width="100%">
+ <tr>
+ <td>
+ <h2>Relation: <%= h(@name) %></h2>
+ </td>
+ <td>
+ <%= render :partial => "navigation" %>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <%= render :partial => "relation_details", :object => @relation %>
+ <hr />
+ <%= link_to "Download XML", :controller => "relation", :action => "read" %>
+ or
+ <%= link_to "view history", :action => "relation_history" %>
+ </td>
+ <td align="right">
+ <% if @relation.visible %>
+ <%= render :partial => "map", :locals => { :type => "relation", :id => @relation.id } %>
+ <% else %>
+ Deleted
+ <% end %>
+ </td>
+ </tr>
+</table>
<h2>Relation History: <%= h(@name) %></h2>
-<%= render :partial => 'common', :locals => { :obj => @relation, :type => "relation" } %>
-<h2>Hisorical Versions</h2>
-<% @relation.old_relations.reverse.each do |relation| %>
-<%= render :partial => 'common_editedby', :locals => { :obj => relation } %>
-<%= render :partial => 'tag_table', :locals => { :tags => relation.tags } %>
-<%= render :partial => 'relation_members', :locals => { :members => relation.old_members } %>
-<hr />
-<% end %>
+
+<table width="100%">
+ <tr valign="top">
+ <td>
+ <% @relation.old_relations.reverse.each do |relation| %>
+ <%= render :partial => "relation_details", :object => relation %>
+ <hr />
+ <% end %>
+ <%= link_to "Download XML", :controller => "old_relation", :action => "history" %>
+ or
+ <%= link_to "view details", :action => "relation" %>
+ </td>
+ <td align="right">
+ <% if @relation.visible %>
+ <%= render :partial => "map", :locals => { :type => "relation", :id => @relation.id } %>
+ <% else %>
+ Deleted
+ <% end %>
+ </td>
+ </tr>
+</table>
-<%= render :partial => 'navigation', :locals => { :type => "way" } %>
-<h2>Way Browser: <%= h(@name) %></h2>
-<%= render :partial => 'common', :locals => { :obj => @way, :type => "way" } %>
-<%= render :partial => 'tag_table', :locals => { :tags => @way.tags } %>
-
-<% if @way.nodes.length != 0 %>
- <br style="clear:both" />
- <div style="float:right; width: 250px;">
- <h2>Parts:</h2>
- <ul>
- <% @way.nodes.each do |node| %>
- <li> <%= link_to "Node " + node.id.to_s, :action => "node", :id => node.id.to_s %> </li>
- <% end %>
- </ul>
- </div>
-<% end %>
+<table width="100%">
+ <tr>
+ <td>
+ <h2>Way: <%= h(@name) %></h2>
+ </td>
+ <td>
+ <%= render :partial => "navigation" %>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <%= render :partial => "way_details", :object => @way %>
+ <hr />
+ <%= link_to "Download XML", :controller => "way", :action => "read" %>
+ or
+ <%= link_to "view history", :action => "way_history" %>
+ </td>
+ <td align="right">
+ <% if @way.visible %>
+ <%= render :partial => "map", :locals => { :type => "way", :id => @way.id } %>
+ <% else %>
+ Deleted
+ <% end %>
+ </td>
+ </tr>
+</table>
<h2>Way History: <%= h(@name) %></h2>
-<%= render :partial => 'common', :locals => { :obj => @way, :type => "way" } %>
-<h2>Hisorical Versions</h2>
-<% @way.old_ways.reverse.each do |way| %>
-<%= render :partial => 'common_editedby', :locals => { :obj => way } %>
-<%= render :partial => 'tag_table', :locals => { :tags => way.tags } %>
-<hr />
-<% end %>
+
+<table width="100%">
+ <tr valign="top">
+ <td>
+ <% @way.old_ways.reverse.each do |way| %>
+ <%= render :partial => "way_details", :object => way %>
+ <hr />
+ <% end %>
+ <%= link_to "Download XML", :controller => "old_way", :action => "history" %>
+ or
+ <%= link_to "view details", :action => "way" %>
+ </td>
+ <td align="right">
+ <% if @way.visible %>
+ <%= render :partial => "map", :locals => { :type => "way", :id => @way.id } %>
+ <% else %>
+ Deleted
+ <% end %>
+ </td>
+ </tr>
+</table>
map.connect "api/#{API_VERSION}/swf/trackpoints", :controller =>'swf', :action =>'trackpoints'
# Data browsing
- map.connect '/browse/start', :controller => 'browse', :action => 'start'
map.connect '/browse', :controller => 'browse', :action => 'index'
+ map.connect '/browse/start', :controller => 'browse', :action => 'start'
map.connect '/browse/way/:id', :controller => 'browse', :action => 'way', :id => /\d+/
map.connect '/browse/way/:id/history', :controller => 'browse', :action => 'way_history', :id => /\d+/
map.connect '/browse/node/:id', :controller => 'browse', :action => 'node', :id => /\d+/