##// END OF EJS Templates
diffs: adding inline comment toggle fixes #2884
lisaq -
r696:d77e3bd5 default
parent child Browse files
Show More
@@ -55,6 +55,7 b' def wrap_to_table(str_):'
55 55 return '''<table class="code-difftable">
56 56 <tr class="line no-comment">
57 57 <td class="add-comment-line tooltip" title="%s"><span class="add-comment-content"></span></td>
58 <td></td>
58 59 <td class="lineno new"></td>
59 60 <td class="code no-comment"><pre>%s</pre></td>
60 61 </tr>
@@ -691,14 +692,14 b' class DiffProcessor(object):'
691 692 anchor_link = False
692 693
693 694 ###########################################################
694 # COMMENT ICON
695 # COMMENT ICONS
695 696 ###########################################################
696 697 _html.append('''\t<td class="add-comment-line"><span class="add-comment-content">''')
697 698
698 699 if enable_comments and change['action'] != Action.CONTEXT:
699 700 _html.append('''<a href="#"><span class="icon-comment-add"></span></a>''')
700 701
701 _html.append('''</span></td>\n''')
702 _html.append('''</span></td><td class="comment-toggle tooltip" title="Toggle Comments"><i class="icon-comment"></i></td>\n''')
702 703
703 704 ###########################################################
704 705 # OLD LINE NUMBER
@@ -31,6 +31,18 b' div.diffblock.margined.comm tr {'
31 31 }
32 32 }
33 33
34 .comment-toggle {
35 display: inline-block;
36 visibility: hidden;
37 width: 20px;
38 color: @rcblue;
39
40 &.active {
41 visibility: visible;
42 cursor: pointer;
43 }
44 }
45
34 46 &.line {
35 47 &:hover, &.hover{
36 48 .add-comment-line a{
@@ -38,7 +38,8 b' var tableTr = function(cls, body){'
38 38 var comment_id = fromHTML(body).children[0].id.split('comment-')[1];
39 39 var id = 'comment-tr-{0}'.format(comment_id);
40 40 var _html = ('<table><tbody><tr id="{0}" class="{1}">'+
41 '<td class="add-comment-line"><span class="add-comment-content"></span></td>'+
41 '<td class="add-comment-line tooltip tooltip" title="Add Comment"><span class="add-comment-content"></span></td>'+
42 '<td></td>'+
42 43 '<td></td>'+
43 44 '<td></td>'+
44 45 '<td>{2}</td>'+
@@ -303,11 +304,24 b' var placeInline = function(target_contai'
303 304 if (show_add_button) {
304 305 placeAddButton(root_parent);
305 306 }
307 addCommentToggle(target_line);
306 308 }
307 309
308 310 return target_line;
309 311 };
310 312
313 var addCommentToggle = function(target_line) {
314 // exposes comment toggle button
315 $(target_line).siblings('.comment-toggle').addClass('active');
316 return;
317 };
318
319 var bindToggleButtons = function() {
320 $('.comment-toggle').on('click', function() {
321 $(this).parent().nextUntil('tr.line').toggle('inline-comments');
322 });
323 };
324
311 325 var linkifyComments = function(comments) {
312 326
313 327 for (var i = 0; i < comments.length; i++) {
@@ -307,6 +307,6 b''
307 307 "#${form_id}", commitId, pullRequestId, lineNo, true);
308 308
309 309 mainCommentForm.initStatusChangeSelector();
310
310 bindToggleButtons();
311 311 </script>
312 312 </%def>
General Comments 0
You need to be logged in to leave comments. Login now