Marge all the changeset list methods together into one.

This commit is contained in:
Tom Hughes 2009-06-07 16:59:58 +00:00
parent 4eb13dac19
commit 9df991e343
11 changed files with 62 additions and 278 deletions

View file

@ -1,3 +1,4 @@
<p>
<% current_page = @edit_pages.current_page %>
<%= t'changeset.changeset_paging_nav.showing_page' %>
@ -16,3 +17,4 @@ if @edit_pages.page_count > 1
<%
end
%>
</p>

View file

@ -1,13 +1,12 @@
<h1><%= t'changeset.list.recent_changes' %></h1>
<p><%= t'changeset.list.recently_edited_changesets' %></p>
<h1><%= t'changeset.list.title' %></h1>
<p><%= @description %></p>
<%= render :partial => 'changesets' %>
<%= render :partial => 'changeset_paging_nav' %>
<%= render :partial => 'changesets', :locals => { :showusername => !params.has_key?(:display_name) } %>
<%= render :partial => 'changeset_paging_nav' %>
<p><%= t'changeset.list.for_more_changesets' %></p>
<br>
<%= rss_link_to :action => 'list_rss' %>
<%= rss_link_to params.merge({ :format => 'rxml' }) %>
<% content_for :head do %>
<%= auto_discovery_link_tag :atom, :controller => 'changeset', :action => 'list_rss' %>
<%= auto_discovery_link_tag :atom, params.merge({ :format => 'rxml' }) %>
<% end %>

View file

@ -2,18 +2,17 @@ xml.rss("version" => "2.0",
"xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#",
"xmlns:georss" => "http://www.georss.org/georss") do
xml.channel do
xml.title t('changeset.list_rss.title')
xml.description t('changeset.list_rss.description')
xml.link url_for(:controller => "browse", :action => "changesets", :only_path => false)
xml.title t('changeset.list.title')
xml.description @description
xml.link url_for(params.merge({ :only_path => false }))
xml.image do
xml.url "http://www.openstreetmap.org/images/mag_map-rss2.0.png"
xml.title "OpenStreetMap"
xml.width "100"
xml.height "100"
xml.link url_for(:controller => "browse", :action => "changesets", :only_path => false)
xml.link url_for(params.merge({ :only_path => false }))
end
for changeset in @edits
xml.item do
xml.title t('browse.changeset.title') + " " + h(changeset.id)

View file

@ -1,51 +0,0 @@
<h1><%= t'changeset.list_bbox.history' %></h1>
<%
if @bbox!=nil
minlon = @bbox[0]
minlat = @bbox[1]
maxlon = @bbox[2]
maxlat = @bbox[3]
%>
<p>
<%= t'changeset.list_bbox.changesets_within_the_area' %>
(<a href='/?minlon=<%= minlon %>&minlat=<%= minlat %>&maxlon=<%= maxlon %>&maxlat=<%= maxlat %>&box=yes' title='<%= t'changeset.list_bbox.show_area_box' %>'><%= format("%0.3f",minlon) -%>,<%= format("%0.3f",minlat) -%>,<%= format("%0.3f",maxlon) -%>,<%= format("%0.3f",maxlat) -%></a>)
</p>
<% if @edits.nil? or @edits.empty? %>
<p><b><%= t'changeset.list_bbox.no_changesets' %></b></p>
<% else %>
<%= render :partial => 'changeset_paging_nav' %>
<%= render :partial => 'changesets' %>
<%= render :partial => 'changeset_paging_nav' %>
<p><%= t'changeset.list_bbox.all_changes_everywhere' , :recent_changes_link => link_to(t('changeset.list_bbox.recent_changes'), :controller => "browse", :action => "changesets") %> </p>
<%
end
else
#bbox is nil. happens if the user surfs to this page directly.
%>
<p><%= t'changeset.list_bbox.no_area_specified' %></p>
<p><%= t'changeset.list_bbox.first_use_view', :view_tab_link => '<a href="/" title="' + t('changeset.list_bbox.view_the_map') + '">' + t('changeset.list_bbox.view_tab') + '</a>' %></p>
<p><%= t'changeset.list_bbox.alternatively_view', :recent_changes_link => link_to(t('changeset.list_bbox.recent_changes'), :controller => "browse", :action => "changesets") %></p>
<%
end
%>
<br>
<% if @bbox %>
<%= rss_link_to :action => 'list_bbox_rss', :bbox => @bbox.join(",") %>
<% end %>
<% if @bbox %>
<% content_for :head do %>
<%= auto_discovery_link_tag :atom, :controller => 'changeset', :action => 'list_bbox_rss', :bbox => @bbox.join(",") %>
<% end %>
<% end %>

View file

@ -1,48 +0,0 @@
xml.rss("version" => "2.0",
"xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#",
"xmlns:georss" => "http://www.georss.org/georss") do
xml.channel do
xml.title t('changeset.list_bbox_rss.title', :bbox => @bbox.join(","))
xml.description t('changeset.list_bbox_rss.description', :bbox => @bbox.join(","))
xml.link url_for(:controller => "history", :bbox => @bbox.join(","), :only_path => false)
xml.image do
xml.url "http://www.openstreetmap.org/images/mag_map-rss2.0.png"
xml.title "OpenStreetMap"
xml.width "100"
xml.height "100"
xml.link url_for(:controller => "history", :bbox => @bbox.join(","), :only_path => false)
end
for changeset in @edits
xml.item do
xml.title t('browse.changeset.title') + " " + h(changeset.id)
xml.link url_for(:controller => 'browse', :action => "changeset", :id => changeset.id, :only_path => false)
xml.guid url_for(:controller => 'browse', :action => "changeset", :id => changeset.id, :only_path => false)
if changeset.user.data_public?
xml.author changeset.user.display_name
end
if changeset.tags['comment']
xml.description changeset.tags['comment']
end
xml.pubDate changeset.created_at.to_s(:rfc822)
if changeset.user.data_public?
xml.comments url_for(:controller => "message", :action => "new", :id => changeset.user.id, :only_path => false)
end
unless changeset.min_lat.nil?
minlon = changeset.min_lon/GeoRecord::SCALE.to_f
minlat = changeset.min_lat/GeoRecord::SCALE.to_f
maxlon = changeset.max_lon/GeoRecord::SCALE.to_f
maxlat = changeset.max_lat/GeoRecord::SCALE.to_f
# See http://georss.org/Encodings#Geometry
lower_corner = "#{minlat} #{minlon}"
upper_corner = "#{maxlat} #{maxlon}"
xml.georss :box, lower_corner + " " + upper_corner
end
end
end
end
end

View file

@ -1,18 +0,0 @@
<h1><%= t'changeset.list_user.edits_by_username', :username_link => link_to(h(@display_name), {:controller=>'user', :action=>'view', :display_name=>@display_name}) %></h1>
<% if not @edits or @edits.empty? %>
<p><b><%= t'changeset.list_user.no_visible_edits_by', :name => h(@display_name) %>.</b></p>
<% else %>
<%= render :partial => 'changeset_paging_nav' %>
<%= render :partial => 'changesets', :locals => {:showusername => false} %>
<%= render :partial => 'changeset_paging_nav' %>
<% end %>
<p><%= t'changeset.list_user.for_all_changes', :recent_changes_link => link_to(t('changeset.list_user.recent_changes'), :controller => "browse", :action => "changesets") %></p>
<br>
<%= rss_link_to :action => 'list_user_rss' %>
<% content_for :head do %>
<%= auto_discovery_link_tag :atom, :controller => 'changeset', :action => 'list_user_rss' %>
<% end %>

View file

@ -1,48 +0,0 @@
xml.rss("version" => "2.0",
"xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#",
"xmlns:georss" => "http://www.georss.org/georss") do
xml.channel do
xml.title t('changeset.list_user_rss.title', :user => @display_name)
xml.description t('changeset.list_user_rss.description', :user => @display_name)
xml.link url_for(:controller => "user", :action => "edits", :id => @display_name, :only_path => false)
xml.image do
xml.url "http://www.openstreetmap.org/images/mag_map-rss2.0.png"
xml.title "OpenStreetMap"
xml.width "100"
xml.height "100"
xml.link url_for(:controller => "user", :action => "edits", :id => @display_name, :only_path => false)
end
for changeset in @edits
xml.item do
xml.title t('browse.changeset.title') + " " + h(changeset.id)
xml.link url_for(:controller => 'browse', :action => "changeset", :id => changeset.id, :only_path => false)
xml.guid url_for(:controller => 'browse', :action => "changeset", :id => changeset.id, :only_path => false)
if changeset.user.data_public?
xml.author changeset.user.display_name
end
if changeset.tags['comment']
xml.description changeset.tags['comment']
end
xml.pubDate changeset.created_at.to_s(:rfc822)
if changeset.user.data_public?
xml.comments url_for(:controller => "message", :action => "new", :id => changeset.user.id, :only_path => false)
end
unless changeset.min_lat.nil?
minlon = changeset.min_lon/GeoRecord::SCALE.to_f
minlat = changeset.min_lat/GeoRecord::SCALE.to_f
maxlon = changeset.max_lon/GeoRecord::SCALE.to_f
maxlat = changeset.max_lat/GeoRecord::SCALE.to_f
# See http://georss.org/Encodings#Geometry
lower_corner = "#{minlat} #{minlon}"
upper_corner = "#{maxlat} #{maxlon}"
xml.georss :box, lower_corner + " " + upper_corner
end
end
end
end
end