]> git.openstreetmap.org Git - rails.git/blob - app/views/api/traces/_trace.builder
Merge remote-tracking branch 'upstream/pull/4944'
[rails.git] / app / views / api / traces / _trace.builder
1 # basic attributes
2
3 attrs = {
4   "id" => trace.id,
5   "name" => trace.name,
6   "uid" => trace.user_id,
7   "user" => trace.user.display_name,
8   "visibility" => trace.visibility,
9   "pending" => trace.inserted ? "false" : "true",
10   "timestamp" => trace.timestamp.xmlschema
11 }
12
13 if trace.inserted
14   attrs["lat"] = trace.latitude.to_s
15   attrs["lon"] = trace.longitude.to_s
16 end
17
18 xml.gpx_file(attrs) do |trace_xml_node|
19   trace_xml_node.description(trace.description)
20   trace.tags.each do |t|
21     trace_xml_node.tag(t.tag)
22   end
23 end