# HG changeset patch # User Steve Losh # Date 1278172251 14400 # Node ID b38c46e3fdf6281b36ae9b11e4c4cf02acfa09df # Parent 83b86632406701878032b410acc3fb7f7a351c8e web: preserve comment bodies when moving line comment forms diff -r 83b866324067 -r b38c46e3fdf6 review/static/comments.js --- a/review/static/comments.js Sat Jul 03 11:46:04 2010 -0400 +++ b/review/static/comments.js Sat Jul 03 11:50:51 2010 -0400 @@ -11,8 +11,8 @@ '{{ currNum }}' + '
' + '' + - '' + + '' + '
' + '
' + @@ -30,9 +30,9 @@ '' ); -function RenderLineCommentForm(line, currNum) { +function RenderLineCommentForm(line, currNum, body) { var filename = line.closest(".file").find(".filename h3 a .name").html(); - return comment_form({ filename: filename, currNum: currNum }); + return comment_form({ filename: filename, currNum: currNum, body: body }); } $(function() { @@ -116,11 +116,12 @@ } else { var existing_form = existing_forms.last(); var existing_form_line_number = parseInt(existing_form.find(".lastlinenumber").html()); + var existing_body = existing_form.find(".body").val(); if (existing_form_line_number != last_line_number) { existing_forms.remove(); - var comment_form = RenderLineCommentForm($(this), last_line_number); + var comment_form = RenderLineCommentForm($(this), last_line_number, existing_body); lines_chosen.last().after(comment_form); diff.find("label").inFieldLabels(); } @@ -130,7 +131,7 @@ diff.find(".comment-form form .lines").val(newLines); } } else { - var comment_form = RenderLineCommentForm($(this), currNum); + var comment_form = RenderLineCommentForm($(this), last_line_number, ''); $(this).after(comment_form); diff.find("label").inFieldLabels(); }