Changeset - 5f0f341c5a44
[Not reviewed]
default
0 1 0
Mads Kiilerich - 10 years ago 2015-08-05 12:29:41
madski@unity3d.com
comments: previous/next links should only be to first comment for a given line

Before, each comment had its own link to previous/next comment - also if it was
right before/after in the same thread. Comments right before/after in the same
thread are however easy to navigate to with scrolling or arrow keys or
pageup/down. Navigating to the next thread could take a lot of clicks to cycle
through every single comment ever made.

Instead, just show the link at the top of each thread and let the links
navigate between threads.

This also make long threads use less vertical space.

One downside of this change is that it for long threads takes a bit more work
to get from the last comment in a thread to the next thread.
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
kallithea/public/js/base.js
Show inline comments
 
@@ -618,25 +618,25 @@ function move_comments($anchorcomments) 
 
        var $anchorcomment = $(anchorcomment);
 
        var target_id = $anchorcomment.data('target-id');
 
        var $comment_div = _get_add_comment_div(target_id);
 
        var f_path = $anchorcomment.data('f_path');
 
        var line_no = $anchorcomment.data('line_no');
 
        if ($comment_div[0]) {
 
            $comment_div.append($anchorcomment.children());
 
            _comment_div_append_add($comment_div, f_path, line_no);
 
        } else {
 
           $anchorcomment.before("Comment to {0} line {1} which is outside the diff context:".format(f_path || '?', line_no || '?'));
 
        }
 
    });
 
    linkInlineComments($('.firstlink'), $('.comment'));
 
    linkInlineComments($('.firstlink'), $('.comment:first-child'));
 
}
 

	
 
// comment bubble was clicked - insert new tr and show form
 
function show_comment_form($bubble) {
 
    var children = $bubble.closest('tr.line').children('[id]');
 
    var line_td_id = children[children.length - 1].id;
 
    var $comment_div = _get_add_comment_div(line_td_id);
 
    var f_path = $bubble.closest('div.full_f_path').data('f_path');
 
    var parts = line_td_id.split('_');
 
    var line_no = parts[parts.length-1];
 
    comment_div_state($comment_div, f_path, line_no, true);
 
}
 
@@ -691,25 +691,25 @@ function _comment_div_append_form($comme
 
        e.preventDefault();
 

	
 
        var text = $('#text_'+line_no).val();
 
        if (!text){
 
            return;
 
        }
 

	
 
        $form.find('.submitting-overlay').show();
 

	
 
        var success = function(json_data) {
 
            $comment_div.append(json_data['rendered_text']);
 
            comment_div_state($comment_div, f_path, line_no, false);
 
            linkInlineComments($('.firstlink'), $('.comment'));
 
            linkInlineComments($('.firstlink'), $('.comment:first-child'));
 
        };
 
        var postData = {
 
            'text': text,
 
            'f_path': f_path,
 
            'line': line_no
 
        };
 
        ajaxPOST(AJAX_COMMENT_URL, postData, success);
 
    });
 

	
 
    $('#preview-btn_'+line_no).click(function(e){
 
        var text = $('#text_'+line_no).val();
 
        if(!text){
0 comments (0 inline, 0 general)