]> git.openstreetmap.org Git - rails.git/blob - app/views/api/notes/feed.rss.builder
Add frozen_string_literal comments to ruby files
[rails.git] / app / views / api / notes / feed.rss.builder
1 # frozen_string_literal: true
2
3 xml.instruct!
4
5 xml.rss("version" => "2.0",
6         "xmlns:dc" => "http://purl.org/dc/elements/1.1/",
7         "xmlns:geo" => "http://www.w3.org/2003/01/geo/wgs84_pos#",
8         "xmlns:georss" => "http://www.georss.org/georss") do
9   xml.channel do
10     xml.title t("api.notes.rss.title")
11     if @min_lat.nil? && @min_lon.nil? && @max_lat.nil? && @max_lon.nil?
12       xml.description t("api.notes.rss.description_all")
13     else
14       xml.description t("api.notes.rss.description_area", :min_lat => @min_lat, :min_lon => @min_lon, :max_lat => @max_lat, :max_lon => @max_lon)
15     end
16     xml.link url_for(:controller => "/site", :action => "index", :only_path => false)
17
18     @comments.each do |comment|
19       location = describe_location(comment.note.lat, comment.note.lon, 14, locale)
20
21       xml.item do
22         xml.title t("api.notes.rss.#{comment.event}", :place => location)
23
24         xml.link url_for(:controller => "/notes", :action => "show", :id => comment.note.id, :anchor => "c#{comment.id}", :only_path => false)
25         xml.guid url_for(:controller => "/notes", :action => "show", :id => comment.note.id, :anchor => "c#{comment.id}", :only_path => false)
26
27         xml.description do
28           xml.cdata! render(:partial => "entry", :object => comment, :formats => [:html])
29         end
30
31         xml.dc :creator, comment.author.display_name if comment.author
32
33         xml.pubDate comment.created_at.to_fs(:rfc822)
34         xml.geo :lat, comment.note.lat
35         xml.geo :long, comment.note.lon
36         xml.georss :point, "#{comment.note.lat} #{comment.note.lon}"
37       end
38     end
39   end
40 end