# HG changeset patch # User Steve Losh # Date 1256255660 14400 # Node ID c5debb47527343edb734f69beb16bdb49f3da82f # Parent a3ad666367563f79cf343723e5bdc85b63669e21 Add file folding. diff -r a3ad66636756 -r c5debb475273 review/web_media/style.css --- a/review/web_media/style.css Thu Oct 22 19:22:34 2009 -0400 +++ b/review/web_media/style.css Thu Oct 22 19:54:20 2009 -0400 @@ -64,6 +64,11 @@ div.filename-header h3 { margin: 0em; } +div.filename-header a.fold-file, div.filename-header a.unfold-file { + float: right; + font-weight: bold; + font-size: 1.5em; +} /* Comments. */ .comment { diff -r a3ad66636756 -r c5debb475273 review/web_media/ui.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/review/web_media/ui.js Thu Oct 22 19:54:20 2009 -0400 @@ -0,0 +1,14 @@ +$(function() { + + $("a.fold-file").toggle(function(event) { + $(event.target).closest("div.file-review").find("div.file-review-contents").slideUp("fast"); + $(event.target).html("   ←").addClass("unfold-file").removeClass("fold-file"); + return false; + }, + function(event) { + $(event.target).closest("div.file-review").find("div.file-review-contents").slideDown("fast"); + $(event.target).html("   ↓").addClass("fold-file").removeClass("unfold-file"); + return false; + }); + +}); \ No newline at end of file diff -r a3ad66636756 -r c5debb475273 review/web_templates/base.html --- a/review/web_templates/base.html Thu Oct 22 19:22:34 2009 -0400 +++ b/review/web_templates/base.html Thu Oct 22 19:54:20 2009 -0400 @@ -9,6 +9,7 @@ + diff -r a3ad66636756 -r c5debb475273 review/web_templates/review.html --- a/review/web_templates/review.html Thu Oct 22 19:22:34 2009 -0400 +++ b/review/web_templates/review.html Thu Oct 22 19:54:20 2009 -0400 @@ -27,90 +27,98 @@ $for filename, diff in rcset.diffs().iteritems(): -
-

${ filename }

-
- - $ file_level_comments = filter(lambda c: c.filename == filename and not c.lines, rcset.comments) - $for comment in file_level_comments: -
-
-
- -
${ comment.message }
+
+
+    ↓ +

${ filename }

+
+ +
+ $ file_level_comments = filter(lambda c: c.filename == filename and not c.lines, rcset.comments) + $for comment in file_level_comments: +
+
+ +
+
+ +
${ comment.message }
+
+
+ + +
+

Add a comment on this file

+
+
+ + +
+
+ +
+ +
+
+ +
+ + $ max_line = diff['max'] + $ content = diff['content'] + $ line_level_comments = filter(lambda c: c.filename == filename and c.lines, rcset.comments) + $ previous_n = -1 + $for n, line in content: + $if n - 1 > previous_n: + $ skipped_count = n - previous_n + $if previous_n == -1: + $ skipped_count -= 1 + + + + $ skipped_comments = filter(lambda c: max(c.lines) in range(previous_n + 1, n), line_level_comments) + $for comment in skipped_comments: + + $ kind = 'rem' if line[0] == '-' else 'add' if line[0] == '+' else 'con' + + + + $ line_comments = filter(lambda c: max(c.lines) == n, line_level_comments) + $for comment in line_comments: + + + + + $ previous_n = n + $if previous_n < max_line: + $ skipped_count = max_line - previous_n + + + +
… skipped ${ skipped_count } lines …
+
+
+ +
${ comment.message }
+
+
${ line[1:] or ' ' }
+
+
+ +
${ comment.message }
+
+
+
+
+ + +
+
+ +
+ + +
+
… skipped ${ skipped_count } lines …
- -
-

Add a comment on this file

-
-
- - -
-
- -
- -
-
- -
- - $ max_line = diff['max'] - $ content = diff['content'] - $ line_level_comments = filter(lambda c: c.filename == filename and c.lines, rcset.comments) - $ previous_n = -1 - $for n, line in content: - $if n - 1 > previous_n: - $ skipped_count = n - previous_n - $if previous_n == -1: - $ skipped_count -= 1 - - - - $ skipped_comments = filter(lambda c: max(c.lines) in range(previous_n + 1, n), line_level_comments) - $for comment in skipped_comments: - - $ kind = 'rem' if line[0] == '-' else 'add' if line[0] == '+' else 'con' - - - - $ line_comments = filter(lambda c: max(c.lines) == n, line_level_comments) - $for comment in line_comments: - - - - - $ previous_n = n - $if previous_n < max_line: - $ skipped_count = max_line - previous_n - - - -
… skipped ${ skipped_count } lines …
-
-
- -
${ comment.message }
-
-
${ line[1:] or ' ' }
-
-
- -
${ comment.message }
-
-
-
-
- - -
-
- -
- - -
-
… skipped ${ skipped_count } lines …
\ No newline at end of file