Add RSS feed for global recent changes & changes within a bbox. Solves #1737
This has so much copy/paste code it hurts, the new list*_rss methods are just copies of the old list* methods, but see #1927 for that.
This commit is contained in:
parent
bbc700b9ac
commit
0d16fd57d4
8 changed files with 123 additions and 10 deletions
|
@ -5,3 +5,9 @@
|
|||
|
||||
<p><%= t'changeset.list.for_more_changesets' %></p>
|
||||
<br>
|
||||
|
||||
<%= rss_link_to :action => 'list_rss' %>
|
||||
|
||||
<% content_for :head do %>
|
||||
<%= auto_discovery_link_tag :atom, :controller => 'changeset', :action => 'list_rss' %>
|
||||
<% end %>
|
||||
|
|
|
@ -39,3 +39,8 @@ end
|
|||
%>
|
||||
<br>
|
||||
|
||||
<%= rss_link_to :action => 'list_bbox_rss', :bbox => @bbox.join(",") %>
|
||||
|
||||
<% content_for :head do %>
|
||||
<%= auto_discovery_link_tag :atom, :controller => 'changeset', :action => 'list_bbox_rss', :bbox => @bbox.join(",") %>
|
||||
<% end %>
|
||||
|
|
51
app/views/changeset/list_bbox_rss.rxml
Normal file
51
app/views/changeset/list_bbox_rss.rxml
Normal file
|
@ -0,0 +1,51 @@
|
|||
xml.instruct!
|
||||
|
||||
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
|
||||
|
|
@ -4,15 +4,15 @@ 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.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.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)
|
||||
xml.link url_for(:controller => "browse", :action => "changesets", :only_path => false)
|
||||
end
|
||||
|
||||
|
||||
|
@ -28,7 +28,9 @@ xml.rss("version" => "2.0",
|
|||
xml.description changeset.tags['comment']
|
||||
end
|
||||
xml.pubDate changeset.created_at.to_s(:rfc822)
|
||||
xml.comments url_for(:controller => "message", :action => "new", :id => changeset.user.id, :only_path => false)
|
||||
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
|
|
@ -11,8 +11,8 @@
|
|||
<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 => 'rss' %>
|
||||
<%= rss_link_to :action => 'list_user_rss' %>
|
||||
|
||||
<% content_for :head do %>
|
||||
<%= auto_discovery_link_tag :atom, :action => 'rss' %>
|
||||
<%= auto_discovery_link_tag :atom, :controller => 'changeset', :action => 'list_user_rss' %>
|
||||
<% end %>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue