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 2af71ab6e..91c572273 100644 --- a/app/assets/javascripts/angular-new/comments/comments_controller.js.coffee +++ b/app/assets/javascripts/angular-new/comments/comments_controller.js.coffee @@ -7,11 +7,11 @@ CommentsController = (Comment, Preview, confirmMessage, $scope, compileHTML, $ro setInlineCommentParams = (params) -> inlineCommentParams = params - findInlineComments = (params) -> + findInlineComments = ($event, params) -> if params.in_reply $('#comment'+params.in_reply).parents('tr').find('td .line-comment:last') else - $() + $($event.target).parent().parent().parent() vm = this @@ -96,30 +96,37 @@ CommentsController = (Comment, Preview, confirmMessage, $scope, compileHTML, $ro else return false - vm.showInlineForm = (params = {}) -> - line_comments = findInlineComments(params) + vm.showInlineForm = ($event, params = {}) -> + line_comments = findInlineComments($event, params) return false if line_comments.count is 0 vm.new_inline_body = null vm.hideInlineForm() setInlineCommentParams(params) - new_form = new_inline_form.html() - new_form = compileHTML.run($scope, new_form) - line_comments.append(new_form) - line_comments.find('#new_inline_comment').addClass('cloned') + if params.in_reply + new_form = compileHTML.run($scope, new_inline_form.html()) + line_comments.append(new_form) + else + new_form = "" + + new_inline_form.html()+"" + new_form = compileHTML.run($scope, new_form) + line_comments.after(new_form) + + line_comments.parent().find('#new_inline_comment').addClass('cloned') true vm.hideInlineForm = -> $('#new_inline_comment.cloned').remove() + inlineCommentParams = {} false vm.hideInlineCommentButton = (params = {}) -> _.isEqual(inlineCommentParams, params) - vm.addInline = -> - inline_comments = findInlineComments(inlineCommentParams) + vm.addInline = ($event) -> + inline_comments = findInlineComments($event, inlineCommentParams) return false if inline_comments.count is 0 vm.processing = true @@ -138,6 +145,7 @@ CommentsController = (Comment, Preview, confirmMessage, $scope, compileHTML, $ro $rootScope.$on "compile_html", (event, args) -> html = compileHTML.run($scope, args.html) args.element.html(html) + true vm.init = (project, commentable = {}) -> vm.project = project diff --git a/app/assets/javascripts/angular-new/pull_requests/pull_request_controller.js.coffee b/app/assets/javascripts/angular-new/pull_requests/pull_request_controller.js.coffee index b1f3a9034..634274937 100644 --- a/app/assets/javascripts/angular-new/pull_requests/pull_request_controller.js.coffee +++ b/app/assets/javascripts/angular-new/pull_requests/pull_request_controller.js.coffee @@ -88,7 +88,7 @@ PullRequestController = (dataservice, $http, ApiPullRequest, ApiProject, DateTim sha: vm.pull.from_ref.sha vm.getActivity = -> - return if vm.pull_updated and vm.is_activity_updated + return if vm.is_pull_updated and vm.is_activity_updated vm.processing = true promise = ApiPullRequest.get_activity(vm.pull_params) @@ -102,7 +102,7 @@ PullRequestController = (dataservice, $http, ApiPullRequest, ApiProject, DateTim false vm.getDiff = -> - return if vm.pull_updated and vm.is_diff_updated + return if vm.is_pull_updated and vm.is_diff_updated vm.processing = true promise = ApiPullRequest.get_diff(vm.pull_params) @@ -116,7 +116,7 @@ PullRequestController = (dataservice, $http, ApiPullRequest, ApiProject, DateTim false vm.getCommits = -> - return if vm.pull_updated and vm.is_commits_updated + return if vm.is_pull_updated and vm.is_commits_updated vm.processing = true promise = ApiPullRequest.get_commits(vm.pull_params) diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index 164e4020c..65e870d6a 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -132,12 +132,12 @@ module DiffHelper def nonewlineline(line) set_line_number - " + " #{td_line_link "#{@diff_prefix}-F#{@diff_counter}L#{line.old_number}", line.old_number} #{td_line_link "#{@diff_prefix}-F#{@diff_counter}R#{line.new_number}", line.new_number} #{line_comment_icon} -
#{render_line(line)}
+
#{render_line(line)}
#{render_line_comments}" @@ -232,14 +232,14 @@ module DiffHelper link_to image_tag('line_comment.png', alt: t('layout.comments.new_header')), '#new_inline_comment', class: 'add_line-comment', - 'ng-click' => "commentsCtrl.showInlineForm(#{new_inline_comment_params.to_json})" + 'ng-click' => "commentsCtrl.showInlineForm($event, #{new_inline_comment_params.to_json})" end end def render_line_comments unless @no_commit_comment || @in_discussion comments = @line_comments.select do |c| - c.data.try('[]', :line) == @num_line.to_s && c.actual_inline_comment? + c.data.try('[]', :line).to_s == @num_line.to_s && c.actual_inline_comment? end tr_line_comments(comments) if comments.count > 0 end @@ -263,7 +263,7 @@ module DiffHelper res << link_to( t('layout.comments.new_inline'), '#new_inline_comment', class: 'btn btn-primary', - 'ng-click' => "commentsCtrl.showInlineForm(#{new_inline_comment_params.to_json})", + 'ng-click' => "commentsCtrl.showInlineForm($event, #{new_inline_comment_params.to_json})", 'ng-hide' => "commentsCtrl.hideInlineCommentButton(#{new_inline_comment_params.to_json})" ) end res << "" diff --git a/app/views/projects/comments/_body.html.slim b/app/views/projects/comments/_body.html.slim index c202fa57e..d85f5c9fc 100644 --- a/app/views/projects/comments/_body.html.slim +++ b/app/views/projects/comments/_body.html.slim @@ -1,5 +1,5 @@ tabset - tab heading = t('layout.edit') + tab.active heading = t('layout.edit') .offset10 - if defined?(ang_model) = f.input :body, label: false, diff --git a/app/views/projects/comments/_new_line.html.slim b/app/views/projects/comments/_new_line.html.slim index 52cf7e1f3..22535d2de 100644 --- a/app/views/projects/comments/_new_line.html.slim +++ b/app/views/projects/comments/_new_line.html.slim @@ -14,6 +14,6 @@ ang_model: 'new_inline_body' hr button.btn.btn-primary[ ng-disabled = 'commentsCtrl.isDisabledNewInlineCommentButton()' - ng-click = 'commentsCtrl.addInline()' ] + ng-click = 'commentsCtrl.addInline($event)' ] = t('layout.create') =< link_to t('layout.cancel'), '', 'ng-click' => 'commentsCtrl.hideInlineForm()' diff --git a/app/views/projects/pull_requests/_pull_diff.html.slim b/app/views/projects/pull_requests/_pull_diff.html.slim index 1c30a02f8..19f7b3051 100644 --- a/app/views/projects/pull_requests/_pull_diff.html.slim +++ b/app/views/projects/pull_requests/_pull_diff.html.slim @@ -2,9 +2,10 @@ .file a name = "diff-#{pull_diff_counter}" .top - .l= h(pull_diff.renamed_file ? "#{pull_diff.a_path.rtruncate 60}=>#{pull_diff.b_path.rtruncate 60}" : pull_diff.b_path.rtruncate(120)) + .pull-left= h(pull_diff.renamed_file ? "#{pull_diff.a_path.rtruncate 60}=>#{pull_diff.b_path.rtruncate 60}" : pull_diff.b_path.rtruncate(120)) - if @pull.from_project.present? - .r= link_to "view file @ #{short_hash_id(commit_id)}", blob_path(@pull.from_project, commit_id, pull_diff.b_path) - .clear + .pull-right= link_to "view file @ #{short_hash_id(commit_id)}", blob_path(@pull.from_project, commit_id, pull_diff.b_path) + .clearfix -if pull_diff.diff.present? && !(@pull.repo.tree(commit_id) / pull_diff.b_path).binary? - .diff_data=render_diff(pull_diff, diff_counter: pull_diff_counter, comments: @comments) + .diff_data== render_diff(pull_diff, diff_counter: pull_diff_counter, comments: @comments) + p= "comments count is #{@comments.count}" \ No newline at end of file diff --git a/app/views/shared/_feed_commit.html.slim b/app/views/shared/_feed_commit.html.slim index b6803ce18..d4638c987 100644 --- a/app/views/shared/_feed_commit.html.slim +++ b/app/views/shared/_feed_commit.html.slim @@ -2,7 +2,7 @@ img alt = 'avatar' src = presenter.image .pull-left strong= presenter.header - = datetime_moment(presenter.date, tag: :strong) + =< datetime_moment(presenter.date, tag: :strong) .clearfix span= presenter.caption - if presenter.expandable? && presenter.content?