]> git.openstreetmap.org Git - rails.git/blob - app/views/changesets/index.atom.builder
Add vips to brew install list
[rails.git] / app / views / changesets / index.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(:action => :index, :format => nil, :only_path => false)),
4           "xmlns:georss" => "http://www.georss.org/georss") do |feed|
5   feed.title changeset_index_title(params, current_user)
6
7   feed.updated @changesets.map { |e| [e.created_at, e.closed_at].max }.max
8   feed.icon image_url("favicon.ico")
9   feed.logo image_url("mag_map-rss2.0.png")
10
11   feed.rights :type => "xhtml" do |xhtml|
12     xhtml.a :href => "https://creativecommons.org/licenses/by-sa/2.0/" do |a|
13       a.img :src => image_url("cc_button.png"), :alt => "CC by-sa 2.0"
14     end
15   end
16
17   @changesets.each do |changeset|
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_show_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       if !changeset.tags.empty? && changeset.tags.key?("comment")
27         entry.title t("browse.changeset.feed.title_comment", :id => changeset.id, :comment => changeset.tags["comment"]), :type => "html"
28       else
29         entry.title t("browse.changeset.feed.title", :id => changeset.id)
30       end
31
32       if changeset.user.data_public?
33         entry.author do |author|
34           author.name changeset.user.display_name
35           author.uri user_url(changeset.user, :only_path => false)
36         end
37       end
38
39       feed.content :type => "xhtml" do |xhtml|
40         xhtml.style "th { text-align: left } tr { vertical-align: top }"
41         xhtml.table do |table|
42           table.tr do |tr|
43             tr.th t("browse.created")
44             tr.td l(changeset.created_at)
45           end
46           table.tr do |tr|
47             tr.th t("browse.closed")
48             tr.td l(changeset.closed_at)
49           end
50           if changeset.user.data_public?
51             table.tr do |tr|
52               tr.th t("browse.changeset.belongs_to")
53               tr.td do |td|
54                 td.a changeset.user.display_name, :href => user_url(changeset.user, :only_path => false)
55               end
56             end
57           end
58           unless changeset.tags.empty?
59             table.tr do |tr|
60               tr.th t("browse.tag_details.tags")
61               tr.td do |td|
62                 td.table :cellpadding => "0" do |tag_table|
63                   changeset.tags.sort.each do |tag|
64                     tag_table.tr do |tag_tr|
65                       tag_tr.td << "#{tag[0]} = #{linkify(tag[1])}"
66                     end
67                   end
68                 end
69               end
70             end
71           end
72         end
73       end
74
75       if changeset.has_valid_bbox?
76         bbox = changeset.bbox.to_unscaled
77
78         # See http://georss.org/Encodings#Geometry
79         lower_corner = "#{bbox.min_lat} #{bbox.min_lon}"
80         upper_corner = "#{bbox.max_lat} #{bbox.max_lon}"
81
82         feed.georss :box, "#{lower_corner} #{upper_corner}"
83       end
84     end
85   end
86 end