Mercurial > kallithea
changeset 6444:e4e13a7cc438
comments: when cancelling an inline comment on a line without comments, don't leave an empty row behind
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Sun, 22 Jan 2017 01:16:51 +0100 |
parents | 31f3a7221f69 |
children | fb565a8b4b4f |
files | kallithea/public/js/base.js |
diffstat | 1 files changed, 4 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/public/js/base.js Wed Jan 18 02:17:08 2017 +0100 +++ b/kallithea/public/js/base.js Sun Jan 22 01:16:51 2017 +0100 @@ -614,7 +614,7 @@ // Set $comment_div state - showing or not showing form and Add button. // An Add button is shown on non-empty forms when no form is shown. -// The form is controlled by show_form - if undefined, form is only shown for general comments. +// The form is controlled by show_form_opt - if undefined, form is only shown for general comments. function comment_div_state($comment_div, f_path, line_no, show_form_opt) { var show_form = show_form_opt !== undefined ? show_form_opt : !f_path && !line_no; var $forms = $comment_div.children('.comment-inline-form'); @@ -626,6 +626,8 @@ _comment_div_append_form($comment_div, f_path, line_no); } else if ($comments.length) { _comment_div_append_add($comment_div, f_path, line_no); + } else { + $comment_div.parent('tr').remove(); } } @@ -704,7 +706,7 @@ ajaxPOST(AJAX_COMMENT_URL, postData, success); }); - // create event for hide button + // add event handler for hide/cancel buttons $form.find('.hide-inline-form').click(function(e) { comment_div_state($comment_div, f_path, line_no); });