# HG changeset patch # User Steve Losh # Date 1276409488 14400 # Node ID 7521b06e6b18ab900790c2b73037ae4f6137399c # Parent 805b5a15398527d53855f6f956005571f09bae1c web: add hovering on comments to highlight lines diff -r 805b5a153985 -r 7521b06e6b18 kick --- a/kick Sun Jun 13 01:53:09 2010 -0400 +++ b/kick Sun Jun 13 02:11:28 2010 -0400 @@ -3,4 +3,5 @@ kicker -qs -l 0.1 -e reload_safari \ review/**.py \ review/**/*.html \ -review/**/*.less +review/**/*.less \ +review/**/*.js diff -r 805b5a153985 -r 7521b06e6b18 review/static/comments.js --- a/review/static/comments.js Sun Jun 13 01:53:09 2010 -0400 +++ b/review/static/comments.js Sun Jun 13 02:11:28 2010 -0400 @@ -11,6 +11,16 @@ $(event.target).parents("form").hide(); return false; }); + + $("tr.comment").hover(function(event) { + var diff = $(event.target).closest(".diff"); + var lines = $(event.target).find(".commentlines").html().split(","); + for (i=0; i < lines.length; i++) { + diff.find(".line-" + lines[i]).addClass("viewing"); + } + }, function(event) { + $(".viewing").removeClass("viewing"); + }); //$("span.cancel-line a").live("click", function(event) { //$(event.target).closest("tr").prev().removeClass("comment-line-selected").addClass("commentable"); diff -r 805b5a153985 -r 7521b06e6b18 review/static/style.css --- a/review/static/style.css Sun Jun 13 01:53:09 2010 -0400 +++ b/review/static/style.css Sun Jun 13 02:11:28 2010 -0400 @@ -450,6 +450,9 @@ border: 1px solid #ddd; background-color: #f9f9f9; } +#changeset .content .diff table tr.viewing { + background-color: #f2f2d7; +} #changeset .content .diff table td.code:after { color: #ccc; content: "↩"; diff -r 805b5a153985 -r 7521b06e6b18 review/static/style.less --- a/review/static/style.less Sun Jun 13 01:53:09 2010 -0400 +++ b/review/static/style.less Sun Jun 13 02:11:28 2010 -0400 @@ -402,6 +402,9 @@ border: 1px solid #ddd; background-color: #f9f9f9; + tr.viewing { + background-color: lighten(@c-cream, 5%); + } td.code:after { color: #ccc; content: "↩"; diff -r 805b5a153985 -r 7521b06e6b18 review/templates/diff.html --- a/review/templates/diff.html Sun Jun 13 01:53:09 2010 -0400 +++ b/review/templates/diff.html Sun Jun 13 02:11:28 2010 -0400 @@ -30,7 +30,7 @@ {% endfor %} {% else %} - + {{ line['number'] }} {{ line['content'][1:]|escape }} @@ -41,6 +41,7 @@ {% for comment in comments %} + {{ ','.join(utils['map'](utils['str'], comment.lines)) }} {{ macros.gravatar(comment, utils) }}
diff -r 805b5a153985 -r 7521b06e6b18 review/web_ui.py --- a/review/web_ui.py Sun Jun 13 01:53:09 2010 -0400 +++ b/review/web_ui.py Sun Jun 13 02:11:28 2010 -0400 @@ -55,6 +55,8 @@ 'item_gravatar': _item_gravatar, 'line_type': _line_type, 'categorize_signoffs': _categorize_signoffs, + 'map': map, + 'str': str, } datastore = None