]> git.openstreetmap.org Git - rails.git/commitdiff
Return note comments as formatted HTML as well as text
authorTom Hughes <tom@compton.nu>
Sun, 2 Dec 2012 17:00:33 +0000 (17:00 +0000)
committerTom Hughes <tom@compton.nu>
Mon, 3 Dec 2012 14:50:55 +0000 (14:50 +0000)
app/views/notes/_note.json.jsonify
app/views/notes/_note.xml.builder

index 5724dfd540fc0392d101544e2079927c4e358b23..c702d9254b49aa886426887da8faf84fcf5b4b94 100644 (file)
@@ -24,6 +24,10 @@ json.properties do
     end
 
     json.action comment.event
-    json.text comment.body unless comment.body.nil?
+
+    if comment.body
+      json.text comment.body.to_text
+      json.html comment.body.to_html
+    end
   end
 end
index 7e4585f86fbacaf37498337ab48a7d2c2d5dac9f..259f70405790cfac915f6f8c25b7edd4480e9dbb 100644 (file)
@@ -21,7 +21,10 @@ xml.note("lon" => note.lon, "lat" => note.lat) do
           xml.user_url user_url(:display_name => comment.author.display_name)
         end
 
-        xml.text comment.body
+        if comment.body
+          xml.text comment.body.to_text
+          xml.html comment.body.to_html
+        end
       end
     end
   end