Link ways and nodes backwards and forwards.

This commit is contained in:
Christopher Schmidt 2008-04-20 20:26:20 +00:00
parent 449567e9a6
commit 35c8871354
4 changed files with 36 additions and 1 deletions

View file

@ -3,6 +3,7 @@ class BrowseController < ApplicationController
layout 'site'
def index
@nodes = Node.find(:all, :order => "timestamp DESC", :limit=> 20)
end
def relation

View file

@ -1 +1,12 @@
Welcome to the browse subpages!
<h2><%= @nodes.length %> Recently Changed Nodes</h2>
<ul>
<% @nodes.each do |node|
name = node.tags_as_hash['name'].to_s
if name.length == 0:
name = "(No name)"
end
name = name + " - " + node.id.to_s
%>
<li><%= link_to h(name), :action => "node", :id => node.id %></li>
<% end %>
</ul>

View file

@ -1,3 +1,14 @@
<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 %>

View file

@ -1,3 +1,15 @@
<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 %>