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