Changeset - 990ec5ed4ee5
[Not reviewed]
default
0 3 0
Thomas De Schampheleire - 11 years ago 2015-01-29 21:48:54
thomas.de_schampheleire@alcatel-lucent.com
comment handling: extend next/previous links to global comments (issue #91)

Until now, only inline comments were linked to each other with next/previous
links.

This commit extends this mechanism to global comments, such that the last
inline comment has a next link to the first global comment, which has a next
link to the next global comment (and the other way around for previous
links).

In order to work well, instead of hiding inline comments that have been
moved, they actually have to be deleted.
3 files changed with 10 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/base.js
Show inline comments
 
@@ -818,6 +818,7 @@ var renderInlineComments = function(file
 
        var target_id = $(box).attr('target_id');
 
        // actual comments with line numbers
 
        var comments = box.children;
 
        var obsolete_comments = [];
 
        for(var i=0; i<comments.length; i++){
 
            var data = {
 
                'rendered_text': comments[i].outerHTML,
 
@@ -825,6 +826,7 @@ var renderInlineComments = function(file
 
                'target_id': target_id
 
            }
 
            if (_renderInlineComment(data)) {
 
                obsolete_comments.push(comments[i]);
 
                $(comments[i]).hide();
 
            }else{
 
                var txt = document.createTextNode(
 
@@ -834,6 +836,12 @@ var renderInlineComments = function(file
 
                comments[i].insertBefore(txt, comments[i].firstChild);
 
            }
 
        }
 
        // now remove all the obsolete comments that have been copied to their
 
        // respective locations.
 
        for (var i=0; i < obsolete_comments.length; i++) {
 
            obsolete_comments[i].parentNode.removeChild(obsolete_comments[i]);
 
        }
 

	
 
        $(box).show();
 
    }
 
}
kallithea/templates/changeset/changeset.html
Show inline comments
 
@@ -208,7 +208,7 @@ ${self.repo_context_bar('changelog', c.c
 
          var file_comments = $('.inline-comment-placeholder').toArray();
 
          renderInlineComments(file_comments);
 

	
 
          linkInlineComments(document.getElementsByClassName('firstlink'), document.getElementsByClassName("inline-comment"));
 
          linkInlineComments(document.getElementsByClassName('firstlink'), document.getElementsByClassName("comment"));
 

	
 
          pyroutes.register('changeset_home',
 
                            "${h.url('changeset_home', repo_name='%(repo_name)s', revision='%(revision)s')}",
kallithea/templates/pullrequests/pullrequest_show.html
Show inline comments
 
@@ -361,7 +361,7 @@ ${self.repo_context_bar('showpullrequest
 
          var file_comments = $('.inline-comment-placeholder').toArray();
 
          renderInlineComments(file_comments);
 

	
 
          linkInlineComments(document.getElementsByClassName('firstlink'), document.getElementsByClassName("inline-comment"));
 
          linkInlineComments(document.getElementsByClassName('firstlink'), document.getElementsByClassName("comment"));
 

	
 
          $('#updaterevs input').change(function(e){
 
              var update = !!e.target.value;
0 comments (0 inline, 0 general)