diff --git a/rhodecode/lib/diffs.py b/rhodecode/lib/diffs.py --- a/rhodecode/lib/diffs.py +++ b/rhodecode/lib/diffs.py @@ -55,6 +55,7 @@ def wrap_to_table(str_): return ''' + @@ -691,14 +692,14 @@ class DiffProcessor(object): anchor_link = False ########################################################### - # COMMENT ICON + # COMMENT ICONS ########################################################### _html.append('''\t\n''') + _html.append('''\n''') ########################################################### # OLD LINE NUMBER diff --git a/rhodecode/public/css/diff.less b/rhodecode/public/css/diff.less --- a/rhodecode/public/css/diff.less +++ b/rhodecode/public/css/diff.less @@ -31,6 +31,18 @@ div.diffblock.margined.comm tr { } } + .comment-toggle { + display: inline-block; + visibility: hidden; + width: 20px; + color: @rcblue; + + &.active { + visibility: visible; + cursor: pointer; + } + } + &.line { &:hover, &.hover{ .add-comment-line a{ diff --git a/rhodecode/public/js/src/rhodecode/comments.js b/rhodecode/public/js/src/rhodecode/comments.js --- a/rhodecode/public/js/src/rhodecode/comments.js +++ b/rhodecode/public/js/src/rhodecode/comments.js @@ -38,7 +38,8 @@ var tableTr = function(cls, body){ var comment_id = fromHTML(body).children[0].id.split('comment-')[1]; var id = 'comment-tr-{0}'.format(comment_id); var _html = ('
%s
''') if enable_comments and change['action'] != Action.CONTEXT: _html.append('''''') - _html.append('''
'+ - ''+ + ''+ + ''+ ''+ ''+ ''+ @@ -303,11 +304,24 @@ var placeInline = function(target_contai if (show_add_button) { placeAddButton(root_parent); } + addCommentToggle(target_line); } return target_line; }; +var addCommentToggle = function(target_line) { + // exposes comment toggle button + $(target_line).siblings('.comment-toggle').addClass('active'); + return; +}; + +var bindToggleButtons = function() { + $('.comment-toggle').on('click', function() { + $(this).parent().nextUntil('tr.line').toggle('inline-comments'); + }); +}; + var linkifyComments = function(comments) { for (var i = 0; i < comments.length; i++) { diff --git a/rhodecode/templates/changeset/changeset_file_comment.html b/rhodecode/templates/changeset/changeset_file_comment.html --- a/rhodecode/templates/changeset/changeset_file_comment.html +++ b/rhodecode/templates/changeset/changeset_file_comment.html @@ -307,6 +307,6 @@ "#${form_id}", commitId, pullRequestId, lineNo, true); mainCommentForm.initStatusChangeSelector(); - + bindToggleButtons();
{2}