adding changeset stuff for the data browser

This commit is contained in:
Shaun McDonald 2008-10-13 20:48:58 +00:00
parent cf24a5a3ee
commit 2c16177174
5 changed files with 73 additions and 0 deletions

View file

@ -112,4 +112,15 @@ class BrowseController < ApplicationController
render :action => "not_found", :status => :not_found render :action => "not_found", :status => :not_found
end end
end end
def changeset
begin
@changeset = Changeset.find(params[:id])
@title = "Changeset | #{@changeset.id}"
rescue ActiveRecord::RecordNotFound
@type = "changeset"
render :action => "not_found", :status => :not_found
end
end
end end

View file

@ -47,6 +47,10 @@ class Changeset < ActiveRecord::Base
return cs return cs
end end
def tags_as_hash
return tags
end
def tags def tags
unless @tags unless @tags
@tags = {} @tags = {}

View file

@ -0,0 +1,19 @@
<table>
<%= render :partial => "common_details", :object => changeset_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>

View file

@ -0,0 +1,38 @@
<table width="100%">
<tr>
<td>
<h2>Changeset: <%= h(@changeset.id) %></h2>
</td>
<td>
<%= render :partial => "navigation" %>
</td>
</tr>
<tr valign="top">
<td>
<tr>
<th>Created at:</th>
<td><%= h(@changeset.created_at) %></td>
</tr>
<% if @changeset.user.data_public? %>
<tr>
<th>Belongs to:</th>
<td><%= link_to h(@changeset.user.display_name), :controller => "user", :action => "view", :display_name => @changeset.user.display_name %></td>
</tr>
<% end %>
<% unless @changeset.tags_as_hash.empty? %>
<tr valign="top">
<th>Tags:</th>
<td>
<table padding="0">
<%= render :partial => "tag", :collection => @changeset.tags_as_hash %>
</table>
</td>
</tr>
<% end %>
<hr />
<%= link_to "Download XML", :controller => "changeset", :action => "read" %>
</td>
<% # render :partial => "map", :object => @node %>
</tr>
</table>

View file

@ -73,6 +73,7 @@ ActionController::Routing::Routes.draw do |map|
map.connect '/browse/node/:id/history', :controller => 'browse', :action => 'node_history', :id => /\d+/ map.connect '/browse/node/:id/history', :controller => 'browse', :action => 'node_history', :id => /\d+/
map.connect '/browse/relation/:id', :controller => 'browse', :action => 'relation', :id => /\d+/ map.connect '/browse/relation/:id', :controller => 'browse', :action => 'relation', :id => /\d+/
map.connect '/browse/relation/:id/history', :controller => 'browse', :action => 'relation_history', :id => /\d+/ map.connect '/browse/relation/:id/history', :controller => 'browse', :action => 'relation_history', :id => /\d+/
map.connect '/browse/changeset/:id', :controller => 'browse', :action => 'changeset', :id => /\d+/
# web site # web site