From 45bad1afc1d0a134bcffd37f14cc5bd944e7a41e Mon Sep 17 00:00:00 2001 From: Alexander Machehin Date: Thu, 15 Jan 2015 23:20:50 +0500 Subject: [PATCH] [#369] pull requests: comments; in progress --- .../angular-new/comments/comments_controller.js.coffee | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/angular-new/comments/comments_controller.js.coffee b/app/assets/javascripts/angular-new/comments/comments_controller.js.coffee index 4885c41d5..971a8b04f 100644 --- a/app/assets/javascripts/angular-new/comments/comments_controller.js.coffee +++ b/app/assets/javascripts/angular-new/comments/comments_controller.js.coffee @@ -21,7 +21,7 @@ CommentsController = (Comment, Preview, confirmMessage, $scope, compileHTML, $ro if line_comments.hasClass('line-comments') new_form = form new_form = compileHTML.run($scope, new_form) - line_comments.find('td:last').append(new_form) + line_comments.find('td.line-comments:last').append(new_form) else new_form = "" + "" + form + "" @@ -130,9 +130,9 @@ CommentsController = (Comment, Preview, confirmMessage, $scope, compileHTML, $ro $('table.table #new_inline_comment').addClass('cloned') true - vm.hideInlineForm = -> + vm.hideInlineForm = (is_new_comment = false)-> parent = $('#new_inline_comment.cloned').parents('tr.line-comments') - if parent.find('.line-comment').length is 1 + if !is_new_comment and parent.find('.line-comment').length is 1 # there is only one line comment, remove all line parent.remove() else @@ -151,8 +151,8 @@ CommentsController = (Comment, Preview, confirmMessage, $scope, compileHTML, $ro vm.processing = true promise = Comment.addInline(vm.project, vm.commentable, vm.new_inline_body, inlineCommentParams) promise.then (response) -> + vm.hideInlineForm(true) insertCommentForm(line_comments, response.data.html) - vm.hideInlineForm() vm.new_inline_body = '' location.hash = "#comment" + response.data.id;