try and make the OpenStreetBugs API a bit more consistent with the rest of the API
[rails.git] / app / views / map_bugs / get_bugs.xml.builder
index be7e9cf7aff5a0f7c81f5e99b3ef9f8ed51c391d..a594506cdbcb5169e71517104169e36da390423a 100644 (file)
@@ -1,23 +1,29 @@
 xml.instruct!
 
-
-xml.gpx("version" => "1.1", 
-        "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance",
-           "xsi:schemaLocation" => "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd") do
-
+xml.bugs do
        for bug in @bugs
-      xml.wpt("lon" => bug.lon, "lat" => bug.lat) do
-               xml.desc do
-                       xml.cdata! bug.flatten_comment("<hr />")
-               end
-               xml.extension do
-                       if bug.status = "open"
-                               xml.closed "0"
-                       else
-                               xml.closed "1"
-                       end
+               xml.bug("lon" => bug.lon, "lat" => bug.lat) do
                        xml.id bug.id
+                       xml.date_created bug.date_created
+                       xml.nearby bug.nearby_place
+                       xml.status bug.status
+                       if bug.status == "closed"
+                               xml.date_closed bug.date_closed
+                       end
+                       xml.comments do
+                               for comment in bug.map_bug_comment
+                                       xml.comment do
+                                               xml.date comment.date_created
+                                               if !comment.commenter_id.nil?
+                                                       xml.uid comment.commenter_id
+                                                       xml.user comment.user.display_name      
+                                               else
+                                                       xml.user comment.commenter_name
+                                               end
+                                               xml.text comment.comment
+                                       end     
+                               end
+                       end
                end
-      end
        end
 end