From 2c16177174d276335babcca5439cd4e97af62ffa Mon Sep 17 00:00:00 2001 From: Shaun McDonald Date: Mon, 13 Oct 2008 20:48:58 +0000 Subject: [PATCH 1/1] adding changeset stuff for the data browser --- app/controllers/browse_controller.rb | 11 +++++++ app/models/changeset.rb | 4 +++ app/views/browse/_changeset_details.rhtml | 19 ++++++++++++ app/views/browse/changeset.rhtml | 38 +++++++++++++++++++++++ config/routes.rb | 1 + 5 files changed, 73 insertions(+) create mode 100644 app/views/browse/_changeset_details.rhtml create mode 100644 app/views/browse/changeset.rhtml diff --git a/app/controllers/browse_controller.rb b/app/controllers/browse_controller.rb index 408846c96..94a8a09a0 100644 --- a/app/controllers/browse_controller.rb +++ b/app/controllers/browse_controller.rb @@ -112,4 +112,15 @@ class BrowseController < ApplicationController render :action => "not_found", :status => :not_found 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 diff --git a/app/models/changeset.rb b/app/models/changeset.rb index 070314e7f..dc6c0e014 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -47,6 +47,10 @@ class Changeset < ActiveRecord::Base return cs end + def tags_as_hash + return tags + end + def tags unless @tags @tags = {} diff --git a/app/views/browse/_changeset_details.rhtml b/app/views/browse/_changeset_details.rhtml new file mode 100644 index 000000000..d8a911f8a --- /dev/null +++ b/app/views/browse/_changeset_details.rhtml @@ -0,0 +1,19 @@ + + + <%= render :partial => "common_details", :object => changeset_details %> + + <% unless node_details.ways.empty? and node_details.containing_relation_members.empty? %> + + + + + <% end %> + +
Part of: + + <% node_details.ways.each do |way| %> + + <% end %> + <%= render :partial => "containing_relation", :collection => node_details.containing_relation_members %> +
<%= link_to "Way " + way.id.to_s, :action => "way", :id => way.id.to_s %>
+
diff --git a/app/views/browse/changeset.rhtml b/app/views/browse/changeset.rhtml new file mode 100644 index 000000000..4ecdb8e99 --- /dev/null +++ b/app/views/browse/changeset.rhtml @@ -0,0 +1,38 @@ + + + + + + + + + + + + <% if @changeset.user.data_public? %> + + + + + <% end %> + <% unless @changeset.tags_as_hash.empty? %> + + + + + <% end %> +
+ <%= link_to "Download XML", :controller => "changeset", :action => "read" %> + + <% # render :partial => "map", :object => @node %> + +
+

Changeset: <%= h(@changeset.id) %>

+
+ <%= render :partial => "navigation" %> +
+
Created at:<%= h(@changeset.created_at) %>
Belongs to:<%= link_to h(@changeset.user.display_name), :controller => "user", :action => "view", :display_name => @changeset.user.display_name %>
Tags: + + <%= render :partial => "tag", :collection => @changeset.tags_as_hash %> +
+
diff --git a/config/routes.rb b/config/routes.rb index 286e4055c..db59a28c8 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -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/relation/:id', :controller => 'browse', :action => 'relation', :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 -- 2.39.5