]> git.openstreetmap.org Git - rails.git/blob - app/views/api/nodes/_node.xml.builder
Refactor common changeset element subpages code
[rails.git] / app / views / api / nodes / _node.xml.builder
1 attrs = {
2   "id" => node.id,
3   "visible" => node.visible,
4   "version" => node.version,
5   "changeset" => node.changeset_id,
6   "timestamp" => node.timestamp.xmlschema,
7   "user" => node.changeset.user.display_name,
8   "uid" => node.changeset.user_id
9 }
10
11 if node.visible
12   attrs["lat"] = node.lat
13   attrs["lon"] = node.lon
14 end
15
16 if node.tags.empty?
17   xml.node(attrs)
18 else
19   xml.node(attrs) do |nd|
20     node.tags.each do |k, v|
21       nd.tag(:k => k, :v => v)
22     end
23   end
24 end