]> git.openstreetmap.org Git - rails.git/blob - app/views/api/notes/_note.json.jbuilder
Add frozen_string_literal comments to ruby files
[rails.git] / app / views / api / notes / _note.json.jbuilder
1 # frozen_string_literal: true
2
3 json.type "Feature"
4
5 json.geometry do
6   json.type "Point"
7   json.coordinates [note.lon.to_f, note.lat.to_f]
8 end
9
10 json.properties do
11   json.id note.id
12   json.url api_note_url(note, :format => params[:format])
13
14   if note.closed?
15     json.reopen_url reopen_api_note_url(note, :format => params[:format])
16   else
17     json.comment_url comment_api_note_url(note, :format => params[:format])
18     json.close_url close_api_note_url(note, :format => params[:format])
19   end
20
21   json.date_created note.created_at.to_s
22   json.status note.status
23   json.closed_at note.closed_at.to_s if note.closed?
24
25   json.comments(note.comments) do |comment|
26     json.date comment.created_at.to_s
27
28     if comment.author
29       json.uid comment.author.id
30       json.user comment.author.display_name
31       json.user_url user_url(:display_name => comment.author.display_name, :only_path => false)
32     end
33
34     json.action comment.event
35
36     if comment.body
37       json.text comment.body.to_text
38       json.html comment.body.to_html
39     end
40   end
41 end