diff --git a/rhodecode/public/css/code-block.less b/rhodecode/public/css/code-block.less --- a/rhodecode/public/css/code-block.less +++ b/rhodecode/public/css/code-block.less @@ -18,15 +18,6 @@ } } -.compare_view_files { - - .diff-container { - - .diffblock { - margin-bottom: 0; - } - } -} div.diffblock .sidebyside { background: #ffffff; diff --git a/rhodecode/public/css/main.less b/rhodecode/public/css/main.less --- a/rhodecode/public/css/main.less +++ b/rhodecode/public/css/main.less @@ -1543,14 +1543,6 @@ table.integrations { } } -.compare_view_files { - width: 100%; - - td { - vertical-align: middle; - } -} - .compare_view_filepath { color: @grey1; } diff --git a/rhodecode/public/css/tables.less b/rhodecode/public/css/tables.less --- a/rhodecode/public/css/tables.less +++ b/rhodecode/public/css/tables.less @@ -485,58 +485,6 @@ table.compare_view_commits { } } -.compare_view_files { - - td.td-actions { - text-align: right; - } - - .flag_status { - margin: 0 0 0 5px; - } - - td.injected_diff { - - .code-difftable { - border:none; - } - - .diff-container { - border: @border-thickness solid @border-default-color; - .border-radius(@border-radius); - } - - div.diffblock { - border:none; - } - - div.code-body { - max-width: 1152px; - } - } - - .rctable { - - td { - padding-top: @space; - } - - &:first-child td { - padding-top: 0; - } - } - - .comment-bubble, - .show_comments { - float: right; - visibility: hidden; - padding: 0 1em 0 0; - } - - .injected_diff { - padding-bottom: @padding; - } -} // Gist List #gist_list_table { diff --git a/rhodecode/public/js/src/rhodecode.js b/rhodecode/public/js/src/rhodecode.js --- a/rhodecode/public/js/src/rhodecode.js +++ b/rhodecode/public/js/src/rhodecode.js @@ -293,44 +293,27 @@ function scrollToElement(element, percen }); } }); - $('.compare_view_files').on( - 'mouseenter mouseleave', 'tr.line .lineno a',function(event) { - if (event.type === "mouseenter") { - $(this).parents('tr.line').addClass('hover'); - } else { - $(this).parents('tr.line').removeClass('hover'); - } - }); - $('.compare_view_files').on( - 'mouseenter mouseleave', 'tr.line .add-comment-line a',function(event){ - if (event.type === "mouseenter") { - $(this).parents('tr.line').addClass('commenting'); - } else { - $(this).parents('tr.line').removeClass('commenting'); - } - }); - - $('body').on( /* TODO: replace the $('.compare_view_files').on('click') below - when new diffs are integrated */ - 'click', '.cb-lineno a', function(event) { + $('body').on('click', '.cb-lineno a', function(event) { function sortNumber(a,b) { return a - b; } - if ($(this).attr('data-line-no') !== "") { + var lineNo = $(this).data('lineNo'); + if (lineNo) { // on shift, we do a range selection, if we got previous line - var prevLine = $('.cb-line-selected a').attr('data-line-no'); + var prevLine = $('.cb-line-selected a').data('lineNo'); if (event.shiftKey && prevLine !== undefined) { var prevLine = parseInt(prevLine); - var nextLine = parseInt($(this).attr('data-line-no')); + var nextLine = parseInt(lineNo); var pos = [prevLine, nextLine].sort(sortNumber); var anchor = '#L{0}-{1}'.format(pos[0], pos[1]); } else { - var nextLine = parseInt($(this).attr('data-line-no')); + + var nextLine = parseInt(lineNo); var pos = [nextLine, nextLine]; var anchor = '#L{0}'.format(pos[0]); @@ -352,54 +335,35 @@ function scrollToElement(element, percen } }); - // Replace URL without jumping to it if browser supports. - // Default otherwise - if (history.pushState) { - var new_location = location.href.rstrip('#'); - if (location.hash) { - // location without hash - new_location = new_location.replace(location.hash, ""); - } - // Make new anchor url - new_location = new_location + anchor; - history.pushState(true, document.title, new_location); - - return false; + } else { + if ($(this).attr('name') !== undefined) { + // clear selection + $('td.cb-line-selected').removeClass('cb-line-selected'); + var aEl = $(this).closest('td'); + aEl.addClass('cb-line-selected'); + aEl.next('td').addClass('cb-line-selected'); } } + + // Replace URL without jumping to it if browser supports. + // Default otherwise + if (history.pushState && anchor !== undefined) { + var new_location = location.href.rstrip('#'); + if (location.hash) { + // location without hash + new_location = new_location.replace(location.hash, ""); + } + + // Make new anchor url + new_location = new_location + anchor; + history.pushState(true, document.title, new_location); + + return false; + } + }); - $('.compare_view_files').on( /* TODO: replace this with .cb function above - when new diffs are integrated */ - 'click', 'tr.line .lineno a',function(event) { - if ($(this).text() != ""){ - $('tr.line').removeClass('selected'); - $(this).parents("tr.line").addClass('selected'); - - // Replace URL without jumping to it if browser supports. - // Default otherwise - if (history.pushState) { - var new_location = location.href; - if (location.hash){ - new_location = new_location.replace(location.hash, ""); - } - - // Make new anchor url - var new_location = new_location+$(this).attr('href'); - history.pushState(true, document.title, new_location); - - return false; - } - } - }); - - $('.compare_view_files').on( - 'click', 'tr.line .add-comment-line a',function(event) { - var tr = $(event.currentTarget).parents('tr.line')[0]; - injectInlineForm(tr); - return false; - }); $('.collapse_file').on('click', function(e) { e.stopPropagation(); 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 @@ -475,7 +475,7 @@ var CommentsController = function() { this.getLineNumber = function(node) { var $node = $(node); - var lineNo = $node.closest('td').attr('data-line-number'); + var lineNo = $node.closest('td').attr('data-line-no'); if (lineNo === undefined && $node.data('commentInline')){ lineNo = $node.data('commentLineNo') } diff --git a/rhodecode/templates/codeblocks/diffs.mako b/rhodecode/templates/codeblocks/diffs.mako --- a/rhodecode/templates/codeblocks/diffs.mako +++ b/rhodecode/templates/codeblocks/diffs.mako @@ -518,7 +518,7 @@ from rhodecode.lib.diffs import NEW_FILE
%if line.original.comments: @@ -532,7 +532,7 @@ from rhodecode.lib.diffs import NEW_FILE
%if use_comments and line.original.lineno: ${render_add_comment_button()} @@ -553,7 +553,7 @@ from rhodecode.lib.diffs import NEW_FILE %endif
%if line.modified.comments: @@ -567,7 +567,7 @@ from rhodecode.lib.diffs import NEW_FILE
%if use_comments and line.modified.lineno: ${render_add_comment_button()} @@ -615,7 +615,7 @@ from rhodecode.lib.diffs import NEW_FILE %if use_comments: ${render_add_comment_button()}