]> git.openstreetmap.org Git - rails.git/blob - app/views/changeset/list.atom.builder
Fix links to changeset feeds.
[rails.git] / app / views / changeset / list.atom.builder
1 atom_feed(:language => I18n.locale, :schema_date => 2009,
2           :id => url_for(params.merge({ :only_path => false })),
3           :root_url => url_for(params.merge({ :only_path => false, :format => nil })),
4           "xmlns:georss" => "http://www.georss.org/georss") do |feed|
5   feed.title @title
6   feed.subtitle @description
7   feed.updated @edits.map {|e|  [e.created_at, e.closed_at].max }.max
8   feed.icon "http://#{SERVER_URL}/favicon.ico"
9   feed.logo "http://#{SERVER_URL}/images/mag_map-rss2.0.png"
10
11   feed.rights :type => 'xhtml' do |xhtml|
12     xhtml.a :href => "http://creativecommons.org/licenses/by-sa/2.0/" do |a|
13       a.img :src => "http://#{SERVER_URL}/images/cc_button.png", :alt => "CC by-sa 2.0"
14     end
15   end
16
17   for changeset in @edits
18     feed.entry(changeset, :updated => changeset.closed_at, :id => changeset_url(changeset.id, :only_path => false)) do |entry|
19       entry.link :rel => "alternate",
20                  :href => changeset_read_url(changeset, :only_path => false),
21                  :type => "application/osm+xml"
22       entry.link :rel => "alternate",
23                  :href => changeset_download_url(changeset, :only_path => false),
24                  :type => "application/osmChange+xml"
25
26       entry.title t('browse.changeset.title') + " " + h(changeset.id)
27
28       if changeset.user.data_public?
29         entry.author do |author|
30           author.name changeset.user.display_name
31           author.uri url_for(:controller => 'user', :action => 'view', :display_name => changeset.user.display_name, :only_path => false)
32         end
33       end
34
35       if changeset.tags['comment']
36         feed.content changeset.tags['comment']
37       end
38
39       unless changeset.min_lat.nil?
40         minlon = changeset.min_lon/GeoRecord::SCALE.to_f
41         minlat = changeset.min_lat/GeoRecord::SCALE.to_f
42         maxlon = changeset.max_lon/GeoRecord::SCALE.to_f
43         maxlat = changeset.max_lat/GeoRecord::SCALE.to_f
44
45         # See http://georss.org/Encodings#Geometry
46         lower_corner = "#{minlat} #{minlon}"
47         upper_corner = "#{maxlat} #{maxlon}"
48
49         feed.georss :box, lower_corner + " " + upper_corner
50       end
51     end
52   end
53 end