Data browser changes, make links more user friendly, displaying name tag where possible.
Changes to models ok'd (and suggested as temporary solution) by TomH References #1777
This commit is contained in:
parent
5b0e72ec71
commit
22292debda
15 changed files with 58 additions and 60 deletions
|
@ -11,13 +11,6 @@ class BrowseController < ApplicationController
|
||||||
|
|
||||||
def relation
|
def relation
|
||||||
@relation = Relation.find(params[:id])
|
@relation = Relation.find(params[:id])
|
||||||
|
|
||||||
@name = @relation.tags['name'].to_s
|
|
||||||
if @name.length == 0:
|
|
||||||
@name = "#" + @relation.id.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
@title = 'Relation | ' + (@name)
|
|
||||||
@next = Relation.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @relation.id }] )
|
@next = Relation.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @relation.id }] )
|
||||||
@prev = Relation.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @relation.id }] )
|
@prev = Relation.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @relation.id }] )
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
@ -27,13 +20,6 @@ class BrowseController < ApplicationController
|
||||||
|
|
||||||
def relation_history
|
def relation_history
|
||||||
@relation = Relation.find(params[:id])
|
@relation = Relation.find(params[:id])
|
||||||
|
|
||||||
@name = @relation.tags['name'].to_s
|
|
||||||
if @name.length == 0:
|
|
||||||
@name = "#" + @relation.id.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
@title = 'Relation History | ' + (@name)
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
@type = "relation"
|
@type = "relation"
|
||||||
render :action => "not_found", :status => :not_found
|
render :action => "not_found", :status => :not_found
|
||||||
|
@ -41,13 +27,6 @@ class BrowseController < ApplicationController
|
||||||
|
|
||||||
def way
|
def way
|
||||||
@way = Way.find(params[:id])
|
@way = Way.find(params[:id])
|
||||||
|
|
||||||
@name = @way.tags['name'].to_s
|
|
||||||
if @name.length == 0:
|
|
||||||
@name = "#" + @way.id.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
@title = 'Way | ' + (@name)
|
|
||||||
@next = Way.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @way.id }] )
|
@next = Way.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @way.id }] )
|
||||||
@prev = Way.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @way.id }] )
|
@prev = Way.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @way.id }] )
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
@ -57,13 +36,6 @@ class BrowseController < ApplicationController
|
||||||
|
|
||||||
def way_history
|
def way_history
|
||||||
@way = Way.find(params[:id])
|
@way = Way.find(params[:id])
|
||||||
|
|
||||||
@name = @way.tags['name'].to_s
|
|
||||||
if @name.length == 0:
|
|
||||||
@name = "#" + @way.id.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
@title = 'Way History | ' + (@name)
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
@type = "way"
|
@type = "way"
|
||||||
render :action => "not_found", :status => :not_found
|
render :action => "not_found", :status => :not_found
|
||||||
|
@ -71,13 +43,6 @@ class BrowseController < ApplicationController
|
||||||
|
|
||||||
def node
|
def node
|
||||||
@node = Node.find(params[:id])
|
@node = Node.find(params[:id])
|
||||||
|
|
||||||
@name = @node.tags_as_hash['name'].to_s
|
|
||||||
if @name.length == 0:
|
|
||||||
@name = "#" + @node.id.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
@title = 'Node | ' + (@name)
|
|
||||||
@next = Node.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @node.id }] )
|
@next = Node.find(:first, :order => "id ASC", :conditions => [ "visible = true AND id > :id", { :id => @node.id }] )
|
||||||
@prev = Node.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @node.id }] )
|
@prev = Node.find(:first, :order => "id DESC", :conditions => [ "visible = true AND id < :id", { :id => @node.id }] )
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
|
@ -87,13 +52,6 @@ class BrowseController < ApplicationController
|
||||||
|
|
||||||
def node_history
|
def node_history
|
||||||
@node = Node.find(params[:id])
|
@node = Node.find(params[:id])
|
||||||
|
|
||||||
@name = @node.tags_as_hash['name'].to_s
|
|
||||||
if @name.length == 0:
|
|
||||||
@name = "#" + @node.id.to_s
|
|
||||||
end
|
|
||||||
|
|
||||||
@title = 'Node History | ' + (@name)
|
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
@type = "way"
|
@type = "way"
|
||||||
render :action => "not_found", :status => :not_found
|
render :action => "not_found", :status => :not_found
|
||||||
|
|
|
@ -2,4 +2,15 @@ module BrowseHelper
|
||||||
def link_to_page(page, page_param)
|
def link_to_page(page, page_param)
|
||||||
return link_to(page, page_param => page)
|
return link_to(page, page_param => page)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def printable_name(object, version=false)
|
||||||
|
name = object.id.to_s
|
||||||
|
if version
|
||||||
|
name = "#{name}, v#{object.version.to_s}"
|
||||||
|
end
|
||||||
|
if object.tags.include? 'name'
|
||||||
|
name = "#{object.tags['name'].to_s} (#{name})"
|
||||||
|
end
|
||||||
|
return name
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,4 +3,6 @@ class OldRelationMember < ActiveRecord::Base
|
||||||
|
|
||||||
set_primary_keys :id, :version, :sequence_id
|
set_primary_keys :id, :version, :sequence_id
|
||||||
belongs_to :relation, :foreign_key=> :id
|
belongs_to :relation, :foreign_key=> :id
|
||||||
|
# A bit messy, referring to the current tables, should do for the data browser for now
|
||||||
|
belongs_to :member, :polymorphic => true
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,4 +4,7 @@ class OldWayNode < ActiveRecord::Base
|
||||||
set_primary_keys :id, :version, :sequence_id
|
set_primary_keys :id, :version, :sequence_id
|
||||||
|
|
||||||
belongs_to :way, :foreign_key=> :id
|
belongs_to :way, :foreign_key=> :id
|
||||||
|
|
||||||
|
# A bit messy, referring to current nodes, should do for the data browser for now
|
||||||
|
belongs_to :node
|
||||||
end
|
end
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
<td>
|
<td>
|
||||||
<table cellpadding="0">
|
<table cellpadding="0">
|
||||||
<% @nodes.each do |node| %>
|
<% @nodes.each do |node| %>
|
||||||
<tr><td><%= link_to "Node #{node.id.to_s}, version #{node.version.to_s}", :action => "node", :id => node.id.to_s %></td></tr>
|
<tr><td><%= link_to h(printable_name(node, true)), :action => "node", :id => node.id.to_s %></td></tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
<td>
|
<td>
|
||||||
<table cellpadding="0">
|
<table cellpadding="0">
|
||||||
<% @ways.each do |way| %>
|
<% @ways.each do |way| %>
|
||||||
<tr><td><%= link_to "Way #{way.id.to_s}, version #{way.version.to_s}", :action => "way", :id => way.id.to_s %></td></tr>
|
<tr><td><%= link_to h(printable_name(way, true)), :action => "way", :id => way.id.to_s %></td></tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%=
|
<%=
|
||||||
#render :partial => "containing_relation", :collection => changeset_details.containing_relation_members
|
#render :partial => "containing_relation", :collection => changeset_details.containing_relation_members
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
<td>
|
<td>
|
||||||
<table cellpadding="0">
|
<table cellpadding="0">
|
||||||
<% @relations.each do |relation| %>
|
<% @relations.each do |relation| %>
|
||||||
<tr><td><%= link_to "Relation #{relation.id.to_s}, version #{relation.version.to_s}", :action => "relation", :id => relation.id.to_s %></td></tr>
|
<tr><td><%= link_to h(printable_name(relation, true)), :action => "relation", :id => relation.id.to_s %></td></tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<%= link_to "Relation " + containing_relation.relation.id.to_s, :action => "relation", :id => containing_relation.relation.id.to_s %>
|
<%= link_to "Relation " + h(printable_name(containing_relation.relation)), :action => "relation", :id => containing_relation.relation.id.to_s %>
|
||||||
<% unless containing_relation.member_role.blank? %>
|
<% unless containing_relation.member_role.blank? %>
|
||||||
(as <%= h(containing_relation.member_role) %>)
|
(as <%= h(containing_relation.member_role) %>)
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<td>
|
<td>
|
||||||
<table cellpadding="0">
|
<table cellpadding="0">
|
||||||
<% node_details.ways.each do |way| %>
|
<% node_details.ways.each do |way| %>
|
||||||
<tr><td><%= link_to "Way " + way.id.to_s, :action => "way", :id => way.id.to_s %></td></tr>
|
<tr><td><%= link_to h(printable_name(way)), :action => "way", :id => way.id.to_s %></td></tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
<%= render :partial => "containing_relation", :collection => node_details.containing_relation_members %>
|
<%= render :partial => "containing_relation", :collection => node_details.containing_relation_members %>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<%= relation_member.member_type.capitalize %>
|
<%= relation_member.member_type.capitalize %>
|
||||||
<%= link_to relation_member.member_id.to_s, :action => relation_member.member_type.downcase, :id => relation_member.member_id %>
|
<%= link_to h(printable_name(relation_member.member)), :action => relation_member.member_type.downcase, :id => relation_member.member_id.to_s %>
|
||||||
<% unless relation_member.member_role.blank? %>
|
<% unless relation_member.member_role.blank? %>
|
||||||
as
|
as
|
||||||
<%= h(relation_member.member_role) %>
|
<%= h(relation_member.member_role) %>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<td>
|
<td>
|
||||||
<table cellpadding="0">
|
<table cellpadding="0">
|
||||||
<% way_details.way_nodes.each do |wn| %>
|
<% 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>
|
<tr><td><%= link_to h(printable_name(wn.node)), :action => "node", :id => wn.node_id.to_s %></td></tr>
|
||||||
<% end %>
|
<% end %>
|
||||||
</table>
|
</table>
|
||||||
</td>
|
</td>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
<%
|
||||||
|
@name = printable_name @node
|
||||||
|
@title = 'Node | ' + @name
|
||||||
|
%>
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
<%
|
||||||
|
@name = printable_name @node
|
||||||
|
@title = 'Node History | ' + @name
|
||||||
|
%>
|
||||||
<h2>Node History: <%= h(@name) %></h2>
|
<h2>Node History: <%= h(@name) %></h2>
|
||||||
|
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
<%
|
||||||
|
@name = printable_name @relation
|
||||||
|
@title = 'Relation | ' + @name
|
||||||
|
%>
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
<%
|
||||||
|
@name = printable_name @relation
|
||||||
|
@title = 'Relation History | ' + @name
|
||||||
|
%>
|
||||||
<h2>Relation History: <%= h(@name) %></h2>
|
<h2>Relation History: <%= h(@name) %></h2>
|
||||||
|
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
<%
|
||||||
|
@name = printable_name @way
|
||||||
|
@title = 'Way | ' + @name
|
||||||
|
%>
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
<%
|
||||||
|
@name = printable_name @way
|
||||||
|
@title = 'Way History | ' + @name
|
||||||
|
%>
|
||||||
<h2>Way History: <%= h(@name) %></h2>
|
<h2>Way History: <%= h(@name) %></h2>
|
||||||
|
|
||||||
<table width="100%">
|
<table width="100%">
|
||||||
|
|
Loading…
Add table
Reference in a new issue