From: Tom Hughes <tom@compton.nu>
Date: Sun, 14 Oct 2012 10:00:33 +0000 (+0100)
Subject: Include useful URLs in note responses
X-Git-Tag: live~6508^2~90
X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/91b3d1a83feba263cb4fe529fb76737f259107ac

Include useful URLs in note responses
---

diff --git a/app/views/notes/_note.gpx.builder b/app/views/notes/_note.gpx.builder
index 4b9aa9869..22d9283ef 100644
--- a/app/views/notes/_note.gpx.builder
+++ b/app/views/notes/_note.gpx.builder
@@ -11,5 +11,8 @@ xml.wpt("lon" => note.lon, "lat" => note.lat) do
     end
 
     xml.id note.id
+    xml.url note_url(note, :format => params[:format])
+    xml.comment_url comment_note_url(note, :format => params[:format])
+    xml.close_url close_note_url(note, :format => params[:format])
   end
 end
diff --git a/app/views/notes/_note.json.jsonify b/app/views/notes/_note.json.jsonify
index ba9ccd944..6afb4a555 100644
--- a/app/views/notes/_note.json.jsonify
+++ b/app/views/notes/_note.json.jsonify
@@ -7,6 +7,9 @@ end
 
 json.properties do
   json.id note.id
+  json.url note_url(note, :format => params[:format])
+  json.comment_url comment_note_url(note, :format => params[:format])
+  json.close_url close_note_url(note, :format => params[:format])
   json.date_created note.created_at
   json.nearby  note.nearby_place
   json.status note.status
diff --git a/app/views/notes/_note.xml.builder b/app/views/notes/_note.xml.builder
index 2a2b2ffc1..c00b49c73 100644
--- a/app/views/notes/_note.xml.builder
+++ b/app/views/notes/_note.xml.builder
@@ -1,5 +1,8 @@
 xml.note("lon" => note.lon, "lat" => note.lat) do
   xml.id note.id
+  xml.url note_url(note, :format => params[:format])
+  xml.comment_url comment_note_url(note, :format => params[:format])
+  xml.close_url close_note_url(note, :format => params[:format])  
   xml.date_created note.created_at
   xml.nearby note.nearby_place
   xml.status note.status