]> git.openstreetmap.org Git - rails.git/blob - app/views/notes/_note.json.jsonify
Merge remote-tracking branch 'upstream/pull/2010'
[rails.git] / app / views / notes / _note.json.jsonify
1 json.type "Feature"
2
3 json.geometry do
4   json.type "Point"
5   json.coordinates [ note.lon.to_f, note.lat.to_f ]
6 end
7
8 json.properties do
9   json.id note.id
10   json.url note_url(note, :format => params[:format])
11
12   if note.closed?
13     json.reopen_url reopen_note_url(note, :format => params[:format])
14   else
15     json.comment_url comment_note_url(note, :format => params[:format])
16     json.close_url close_note_url(note, :format => params[:format])
17   end
18
19   json.date_created note.created_at
20   json.status note.status
21   json.closed_at note.closed_at if note.closed?
22
23   json.comments(note.comments) do |comment|
24     json.date comment.created_at
25
26     if comment.author
27       json.uid comment.author.id
28       json.user comment.author.display_name
29       json.user_url user_url(:display_name => comment.author.display_name, :only_path => false)
30     end
31
32     json.action comment.event
33
34     if comment.body
35       json.text comment.body.to_text
36       json.html comment.body.to_html
37     end
38   end
39 end