# HG changeset patch # User Steve Losh # Date 1269709380 14400 # Node ID f841259cc87e61c7d55c99564a6d5d2d26eb5483 # Parent 048ef4889301111fc8bd308f12fd46d3a37adf82 Move the individual line comment forms into comments.js. This *massively* improves performance on large diffs. For example, the review page for the changeset where I added CherryPy as a bundled app was 38.7mb before this changeset. With this change it is now 13.2mb. diff -r 048ef4889301 -r f841259cc87e review/web_media/comments.js --- a/review/web_media/comments.js Sat Mar 27 12:22:04 2010 -0400 +++ b/review/web_media/comments.js Sat Mar 27 13:03:00 2010 -0400 @@ -11,7 +11,28 @@ $("tr.rem.commentable,tr.add.commentable,tr.con.commentable").click(function(event) { $(event.target).closest("tr").addClass("comment-line-selected"); - $(event.target).closest("tr").nextAll("tr.comment-line").first().fadeIn("fast"); + var filename = $(event.target).closest("tr").find(".line-data").children(".filename").first().text(); + var linenumber = $(event.target).closest("tr").find(".line-data").children(".linenumber").first().html(); + + var comment_form = '\n\ + \n\ +
\n\ +
\n\ + \n\ + \n\ +
\n\ +
\n\ + \n\ +
\n\ + \n\ + \n\ +
\n\ + \n\ + '; + comment_form = comment_form.replace('<<>>', filename); + comment_form = comment_form.replace('<<>>', linenumber); + + $(event.target).closest("tr").after(comment_form); return false; }); diff -r 048ef4889301 -r f841259cc87e review/web_media/style.css --- a/review/web_media/style.css Sat Mar 27 12:22:04 2010 -0400 +++ b/review/web_media/style.css Sat Mar 27 13:03:00 2010 -0400 @@ -163,15 +163,18 @@ div.diff table tr.comment-line { white-space: normal; } -table tr.add { +div.diff table tr.add { background: #DBF3D1; } -table tr.rem { +div.diff table tr.rem { background: #FBDBDA; } -table tr.skipped { +div.diff table tr.skipped { background: #ccc; } +div.diff table tr td.diff-line div.line-data { + display: none; +} div.diff .comment { margin-bottom: 0em; -} \ No newline at end of file +} diff -r 048ef4889301 -r f841259cc87e review/web_templates/changeset.html --- a/review/web_templates/changeset.html Sat Mar 27 12:22:04 2010 -0400 +++ b/review/web_templates/changeset.html Sat Mar 27 13:03:00 2010 -0400 @@ -125,7 +125,7 @@ {% endfor %} {% else %} - {{ line['number'] }}: {{ line['content'][1:]|escape }} +
{{ line['number'] }}{{ filename }}
{{ line['number'] }}: {{ line['content'][1:]|escape }} {% for comment in line['comments'] %} {{ macros.gravatar(comment, utils) }} @@ -140,20 +140,6 @@ {% endfor %} - - -
-
- - -
-
- -
- - -
- {% endif %} {% endfor %}