]> git.openstreetmap.org Git - rails.git/blob - app/views/note/rss.rss.builder
Merge branch 'master' into openstreetbugs
[rails.git] / app / views / note / rss.rss.builder
1 xml.instruct!
2
3 xml.rss("version" => "2.0", 
4         "xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#",
5         "xmlns:georss" => "http://www.georss.org/georss") do
6   xml.channel do
7     xml.title t('note.rss.title')
8     xml.description t('note.rss.description_area', :min_lat => @min_lat, :min_lon => @min_lon, :max_lat => @max_lat, :max_lon => @max_lon )
9     xml.link url_for(:controller => "site", :action => "index", :only_path => false)
10
11     @comments.each do |comment|
12       xml.item do
13         if comment.event == "closed"
14           xml.title t('note.rss.closed', :place => comment.note.nearby_place)   
15         elsif comment.event == "commented"
16           xml.title t('note.rss.comment', :place => comment.note.nearby_place)
17         elsif comment.event == "opened"
18           xml.title t('note.rss.new', :place => comment.note.nearby_place)
19         else
20           xml.title "unknown event"
21         end
22         
23         xml.link url_for(:controller => "browse", :action => "note", :id => comment.note.id, :only_path => false)
24         xml.guid url_for(:controller => "browse", :action => "note", :id => comment.note.id, :only_path => false)
25
26         description_text = ""
27
28         if comment.event == "commented" and not comment.nil?
29           description_text += "<b>Comment:</b><br>"
30           description_text += htmlize(comment.body)
31           description_text += "<br>"
32         end
33
34         description_text += "<b>Full note:</b><br>"
35         description_text += comment.note.flatten_comment("<br>", comment.created_at)
36
37         xml.description description_text 
38         xml.author comment.author_name
39         xml.pubDate comment.created_at.to_s(:rfc822)
40         xml.geo :lat, comment.note.lat
41         xml.geo :long, comment.note.lon
42         xml.georss :point, "#{comment.note.lat} #{comment.note.lon}"
43       end
44     end
45   end
46 end