]> git.openstreetmap.org Git - rails.git/blob - app/views/api/changesets/_changeset.json.jbuilder
Merge pull request #5331 from AntonKhorev/trace-badges-text-bg
[rails.git] / app / views / api / changesets / _changeset.json.jbuilder
1 # basic attributes
2 json.id changeset.id
3 json.created_at changeset.created_at.xmlschema
4 json.open changeset.open?
5 json.comments_count changeset.comments.length
6 json.changes_count changeset.num_changes
7
8 json.closed_at changeset.closed_at.xmlschema unless changeset.open?
9 if changeset.bbox.complete?
10   json.min_lat GeoRecord::Coord.new(changeset.bbox.to_unscaled.min_lat)
11   json.min_lon GeoRecord::Coord.new(changeset.bbox.to_unscaled.min_lon)
12   json.max_lat GeoRecord::Coord.new(changeset.bbox.to_unscaled.max_lat)
13   json.max_lon GeoRecord::Coord.new(changeset.bbox.to_unscaled.max_lon)
14 end
15
16 # user attributes
17 if changeset.user.data_public?
18   json.uid changeset.user_id
19   json.user changeset.user.display_name
20 end
21
22 json.tags changeset.tags unless changeset.tags.empty?
23
24 if @comments
25   json.comments(@comments) do |comment|
26     json.id comment.id
27     json.visible comment.visible
28     json.date comment.created_at.xmlschema
29     if comment.author.data_public?
30       json.uid comment.author.id
31       json.user comment.author.display_name
32     end
33     json.text comment.body
34   end
35 end