# HG changeset patch # User Steve Losh # Date 1276408389 14400 # Node ID 805b5a15398527d53855f6f956005571f09bae1c # Parent 191d8a0d619068c586d406884104bd2100743232 web: get diffs looking nice (and add kick) diff -r 191d8a0d6190 -r 805b5a153985 kick --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kick Sun Jun 13 01:53:09 2010 -0400 @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +kicker -qs -l 0.1 -e reload_safari \ +review/**.py \ +review/**/*.html \ +review/**/*.less diff -r 191d8a0d6190 -r 805b5a153985 review/static/style.css --- a/review/static/style.css Sun Jun 13 00:23:16 2010 -0400 +++ b/review/static/style.css Sun Jun 13 01:53:09 2010 -0400 @@ -445,3 +445,53 @@ #changeset .content .file .add-file-comment { margin-bottom: 24px; } +#changeset .content .diff table { + width: 100%; + border: 1px solid #ddd; + background-color: #f9f9f9; +} +#changeset .content .diff table td.code:after { + color: #ccc; + content: "↩"; + vertical-align: -1px; + line-height: 1; +} +#changeset .content .diff table td { + border: none; + line-height: 1; + padding: 3px 5px; +} +#changeset .content .diff table td.linenumber { + width: 25px; + text-align: right; + font-family: Monaco, Consolas, "Courier New", monospace; + color: #888888; +} +#changeset .content .diff table td.skip { + text-align: right; + color: #888888; +} +#changeset .content .diff table td.code { + white-space: pre; +} +#changeset .content .diff table td.comment { + line-height: 15px; + padding: 10px 10px 10px 36px; + border-bottom: 1px solid #eee; + border-top: 1px solid #eee; + background-color: #f4f4f4; +} +#changeset .content .diff table td.comment .avatar { + float: right; +} +#changeset .content .diff table td.comment .avatar img { + height: 30px; + width: 30px; +} +#changeset .content .diff table td.comment .message { + white-space: pre; + font-family: Monaco, Consolas, "Courier New", monospace; +} +#changeset .content .diff table td.comment .author { + padding-bottom: 3px; +} diff -r 191d8a0d6190 -r 805b5a153985 review/static/style.less --- a/review/static/style.less Sun Jun 13 00:23:16 2010 -0400 +++ b/review/static/style.less Sun Jun 13 01:53:09 2010 -0400 @@ -396,4 +396,60 @@ margin-bottom: 24px; } } + .diff { + table{ + width: 100%; + border: 1px solid #ddd; + background-color: #f9f9f9; + + td.code:after { + color: #ccc; + content: "↩"; + vertical-align: -1px; + line-height: 1; + } + td { + border: none; + line-height: 1; + padding: 3px 5px; + + &.linenumber { + width: 25px; + text-align: right; + font-family: @font-mono; + color: @c-light; + } + &.skip { + text-align: right; + color: @c-light; + } + &.code { + white-space: pre; + } + &.comment { + line-height: 15px; + padding: 10px 10px 10px 36px; + border-bottom: 1px solid #eee; + border-top: 1px solid #eee; + background-color: #f4f4f4; + + .avatar { + float: right; + + img { + height: 30px; + width: 30px; + } + } + .message { + white-space: pre; + font-family: @font-mono; + } + .author { + padding-bottom: 3px; + } + } + } + } + } } diff -r 191d8a0d6190 -r 805b5a153985 review/static/ui.js --- a/review/static/ui.js Sun Jun 13 00:23:16 2010 -0400 +++ b/review/static/ui.js Sun Jun 13 01:53:09 2010 -0400 @@ -1,5 +1,4 @@ $(function() { - $("a.fold").toggle(function(event) { $(event.target).closest(".file").find(".file-review-contents").slideDown("fast", function() { $(event.target).closest("h3").find(".status").html("↓"); @@ -14,5 +13,4 @@ }); return false; }); - }); diff -r 191d8a0d6190 -r 805b5a153985 review/templates/changeset.html --- a/review/templates/changeset.html Sun Jun 13 00:23:16 2010 -0400 +++ b/review/templates/changeset.html Sun Jun 13 01:53:09 2010 -0400 @@ -108,7 +108,7 @@

{{ filename }}

-
+
{% with %} {% set comments = rcset.file_level_comments(filename) %} @@ -148,57 +148,7 @@
{% endif %} -
- - - {% set annotated_diff = rcset.annotated_diff(filename) %} - {# We need to ignore the first item from this generator, because - we don't care about providing a line-number prefix (for now!). #} - {% set ignore_this_variable = annotated_diff.next() %} - - {% for line in annotated_diff %} - {% if line['skipped'] %} - - - - {% for comment in line['comments'] %} - - {% endfor %} - {% else %} - - - - - {% for comment in line['comments'] %} - - {% endfor %} - {% endif %} - {% endfor %} - -
… skipped {{ line['skipped'] }} lines …
- {{ macros.gravatar(comment, utils) }} -
- -
{{ comment.message|escape }}
-
-
{{ line['number'] }}{{ filename }}
{{ line['number'] }}: {{ line['content'][1:]|escape }}
- {{ macros.gravatar(comment, utils) }} -
- -
{{ comment.message }}
-
-
-
+ {% include "diff.html" %}
{% endfor %} diff -r 191d8a0d6190 -r 805b5a153985 review/templates/diff.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/review/templates/diff.html Sun Jun 13 01:53:09 2010 -0400 @@ -0,0 +1,63 @@ +
+ + + + {% set annotated_diff = rcset.annotated_diff(filename) %} + {# We need to ignore the first item from this generator, because + we don't care about providing a line-number prefix (for now!). #} + {% set ignore_this_variable = annotated_diff.next() %} + + {% for line in annotated_diff %} + {% if line['skipped'] %} + + + + + {% for comment in line['comments'] %} + + {% endfor %} + {% else %} + + + + + + {% with %} + {% set comments = line['comments'] %} + + {% for comment in comments %} + + + + {% endfor %} + {% endwith %} + {% endif %} + {% endfor %} + +
+ … skipped {{ line['skipped'] }} lines … +
+ {{ macros.gravatar(comment, utils) }} +
+ +
{{ comment.message|escape }}
+
+
{{ line['number'] }}{{ line['content'][1:]|escape }}
+ {{ macros.gravatar(comment, utils) }} +
+ +
{{ comment.message }}
+
+
+ +