diff --git a/src/main/twirl/gitbucket/core/helper/diff.scala.html b/src/main/twirl/gitbucket/core/helper/diff.scala.html index 46ccbf6..bf16270 100644 --- a/src/main/twirl/gitbucket/core/helper/diff.scala.html +++ b/src/main/twirl/gitbucket/core/helper/diff.scala.html @@ -238,7 +238,6 @@ var $this = $(this); var $tr = $this.closest('tr'); var $check = $this.closest('table:not(.diff)').find('.toggle-notes'); - //var url = ''; if (!$check.prop('checked')) { $check.prop('checked', true).trigger('change'); } diff --git a/src/main/twirl/gitbucket/core/issues/commentlist.scala.html b/src/main/twirl/gitbucket/core/issues/commentlist.scala.html index 0211a2d..8406bb0 100644 --- a/src/main/twirl/gitbucket/core/issues/commentlist.scala.html +++ b/src/main/twirl/gitbucket/core/issues/commentlist.scala.html @@ -186,11 +186,7 @@ $content = $('#issueContent'); } - $.get(url, - { - dataType : 'html' - }, - function(data){ + $.get(url, { dataType : 'html' }, function(data){ $content.empty().html(data); }); return false; @@ -198,8 +194,7 @@ $('.issue-comment-box i.octicon-x').click(function(){ if(confirm('Are you sure you want to delete this?')) { var id = $(this).closest('a').data('comment-id'); - $.post('@helpers.url(repository)/issue_comments/delete/' + id, - function(data){ + $.post('@helpers.url(repository)/issue_comments/delete/' + id, function(data){ if(data > 0) { $('#comment-' + id).remove(); } @@ -213,22 +208,24 @@ var url = '@helpers.url(repository)/commit_comments/_data/' + id; var $content = $('.commit-commentContent-' + id, $(this).closest('.commit-comment-box')); - $.get(url, - { - dataType : 'html' - }, - function(data){ + $.get(url, { dataType : 'html' }, function(data){ $content.empty().html(data); }); + return false; }); + $(document).on('click', '.commit-comment-box i.octicon-x', function(){ if(confirm('Are you sure you want to delete this?')) { var id = $(this).closest('a').data('comment-id'); $.post('@helpers.url(repository)/commit_comments/delete/' + id, function(data){ if(data > 0) { - $('.commit-comment-' + id).closest('.not-diff').remove(); + var comment = $('.commit-comment-' + id).closest('.not-diff'); + if(comment.prev('.not-diff').length == 0){ + comment.next('.not-diff').find('.reply-comment').remove(); + } + comment.remove(); } }); } @@ -260,10 +257,7 @@ var $commentContent = $(ev.target).parents('div[class*=commit-commentContent-]'), commentId = $commentContent.attr('class').match(/commit-commentContent-.+/)[0].replace(/commit-commentContent-/, ''), checkboxes = $commentContent.find(':checkbox'); - $.get('@helpers.url(repository)/commit_comments/_data/' + commentId, - { - dataType : 'html' - }, + $.get('@helpers.url(repository)/commit_comments/_data/' + commentId, { dataType : 'html' }, function(responseContent){ $.ajax({ url: '@helpers.url(repository)/commit_comments/edit/' + commentId, @@ -283,10 +277,7 @@ @if(issue.isDefined){ $('#issueContent').on('click', ':checkbox', function(ev){ var checkboxes = $('#issueContent :checkbox'); - $.get('@helpers.url(repository)/issues/_data/@issue.get.issueId', - { - dataType : 'html' - }, + $.get('@helpers.url(repository)/issues/_data/@issue.get.issueId', { dataType : 'html' }, function(responseContent){ $.ajax({ url: '@helpers.url(repository)/issues/edit/@issue.get.issueId', @@ -304,10 +295,7 @@ var $commentContent = $(ev.target).parents('div[id^=commentContent-]'), commentId = $commentContent.attr('id').replace(/commentContent-/, ''), checkboxes = $commentContent.find(':checkbox'); - $.get('@helpers.url(repository)/issue_comments/_data/' + commentId, - { - dataType : 'html' - }, + $.get('@helpers.url(repository)/issue_comments/_data/' + commentId, { dataType : 'html' }, function(responseContent){ $.ajax({ url: '@helpers.url(repository)/issue_comments/edit/' + commentId, diff --git a/src/main/twirl/gitbucket/core/repo/commentform.scala.html b/src/main/twirl/gitbucket/core/repo/commentform.scala.html index 1e0b20c..a681862 100644 --- a/src/main/twirl/gitbucket/core/repo/commentform.scala.html +++ b/src/main/twirl/gitbucket/core/repo/commentform.scala.html @@ -71,8 +71,19 @@ // Show reply comment form var replyComment = $tr.prev().find('.reply-comment').closest('.not-diff').show(); - replyComment.remove(); - $tr.after(replyComment); + if(replyComment.length != 0){ + replyComment.remove(); + $tr.after(replyComment); + } else { + var $v = $('