# HG changeset patch # User Steve Losh # Date 1278172824 14400 # Node ID c904a77b6bef9c3ff7b0fb4c727bbdfc9e8eecf9 # Parent b38c46e3fdf6281b36ae9b11e4c4cf02acfa09df web: preserve markdown status when moving line comment forms diff -r b38c46e3fdf6 -r c904a77b6bef review/static/comments.js --- a/review/static/comments.js Sat Jul 03 11:50:51 2010 -0400 +++ b/review/static/comments.js Sat Jul 03 12:00:24 2010 -0400 @@ -16,7 +16,7 @@ '' + '
' + - '' + + '' + '' + '
' + @@ -30,9 +30,10 @@ '' ); -function RenderLineCommentForm(line, currNum, body) { +function RenderLineCommentForm(line, currNum, body, markdown) { var filename = line.closest(".file").find(".filename h3 a .name").html(); - return comment_form({ filename: filename, currNum: currNum, body: body }); + markdown_checked = markdown ? 'checked="checked"' : ''; + return comment_form({ filename: filename, currNum: currNum, body: body, markdown_checked: markdown_checked }); } $(function() { @@ -117,11 +118,12 @@ 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(); + var markdown = existing_form.find('.markdown-select').is(':checked'); if (existing_form_line_number != last_line_number) { existing_forms.remove(); - var comment_form = RenderLineCommentForm($(this), last_line_number, existing_body); + var comment_form = RenderLineCommentForm($(this), last_line_number, existing_body, markdown); lines_chosen.last().after(comment_form); diff.find("label").inFieldLabels(); } @@ -131,7 +133,7 @@ diff.find(".comment-form form .lines").val(newLines); } } else { - var comment_form = RenderLineCommentForm($(this), last_line_number, ''); + var comment_form = RenderLineCommentForm($(this), last_line_number, '', true); $(this).after(comment_form); diff.find("label").inFieldLabels(); }