From 0b981e4b7fd1aa85ac635fdb6d2cb58d9a2fd81d Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 23 Sep 2012 15:30:19 +0100 Subject: [PATCH] Generate proper descriptions for notes --- app/assets/javascripts/notes.js.erb | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/assets/javascripts/notes.js.erb b/app/assets/javascripts/notes.js.erb index 01264bcb6..c55c11ec9 100644 --- a/app/assets/javascripts/notes.js.erb +++ b/app/assets/javascripts/notes.js.erb @@ -13,6 +13,17 @@ function addNoteLayer(map, notesUrl, newNoteControls, newNoteForm, minZoom) { newNotes = undefined; }; + var describeNote = function (n) { + var description = "

Note " + n.id + "

"; + + n.comments.forEach(function (c) { + description += "

" + c.action + " by "; + description += c.user + " at " + c.date + "
" + c.text + "

"; + }); + + return description; + } + var noteSelected = function (o) { var feature = o.feature; var location = feature.geometry.getBounds().getCenterLonLat(); @@ -25,7 +36,7 @@ function addNoteLayer(map, notesUrl, newNoteControls, newNoteForm, minZoom) { content = form.html(); close = false; } else { - content = "

" + feature.attributes.id + "

"; + content = describeNote(feature.attributes); close = true; }; -- 2.43.2