]> git.openstreetmap.org Git - rails.git/blob - app/views/api/notes/_note.xml.builder
Simplify partial rendering when the partial is named after the model
[rails.git] / app / views / api / notes / _note.xml.builder
1 xml.note("lon" => note.lon, "lat" => note.lat) do
2   xml.id note.id
3   xml.url note_url(note, :format => params[:format])
4
5   if note.closed?
6     xml.reopen_url reopen_note_url(note, :format => params[:format])
7   else
8     xml.comment_url comment_note_url(note, :format => params[:format])
9     xml.close_url close_note_url(note, :format => params[:format])
10   end
11
12   xml.date_created note.created_at
13   xml.status note.status
14
15   xml.date_closed note.closed_at if note.closed?
16
17   xml.comments do
18     note.comments.each do |comment|
19       xml.comment do
20         xml.date comment.created_at
21
22         if comment.author
23           xml.uid comment.author.id
24           xml.user comment.author.display_name
25           xml.user_url user_url(:display_name => comment.author.display_name, :only_path => false)
26         end
27
28         xml.action comment.event
29
30         if comment.body
31           xml.text comment.body.to_text
32           xml.html comment.body.to_html
33         end
34       end
35     end
36   end
37 end