# HG changeset patch # User Steve Losh # Date 1255561560 14400 # Node ID efc3c9173ce1c1b9e4a4e6fe6c5e6919cb8f0b99 # Parent 78cd41b87ea2b865ca4d5c6343c72066fb06152e Add template inheritance. Not liking Templetor so far... diff -r 78cd41b87ea2 -r efc3c9173ce1 review/web_media/style.css --- a/review/web_media/style.css Tue Oct 13 21:12:15 2009 -0400 +++ b/review/web_media/style.css Wed Oct 14 19:06:00 2009 -0400 @@ -1,13 +1,28 @@ /* Basic layout and typography. */ body { - background: #666; + background: #f5f5f5; } div#main-wrap { - background: #f5f5f5; width: 65em; - margin: 3em auto; + margin: 0em auto; padding: 3em; - border: 1px solid #333; +} +div#head-wrap { + text-align: center; + padding: 1.5em 0em .5em; + background-color: #105E0F; + color: #fff; + border-bottom: 1px solid #114700; +} + +/* Links. */ +a { + text-decoration: none; + font-weight: bold; + color: #297E00; +} +a:hover { + color: #EA0076; } /* Tables. */ @@ -31,8 +46,8 @@ white-space: pre; } table tr.add { - background: #beb; + background: #DBF3D1; } table tr.rem { - background: #fcc; + background: #FBDBDA; } \ No newline at end of file diff -r 78cd41b87ea2 -r efc3c9173ce1 review/web_templates/base.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/review/web_templates/base.html Wed Oct 14 19:06:00 2009 -0400 @@ -0,0 +1,20 @@ +$def with (rd, content) + + + + + ${ basename(rd.target.root) } / hg-review + + + + + +
+

${ basename(rd.target.root) }

+
+
+ $:{ content } +
+ + \ No newline at end of file diff -r 78cd41b87ea2 -r efc3c9173ce1 review/web_templates/index.html --- a/review/web_templates/index.html Tue Oct 13 21:12:15 2009 -0400 +++ b/review/web_templates/index.html Wed Oct 14 19:06:00 2009 -0400 @@ -1,34 +1,18 @@ $def with (rd, revs) - - - - ${ basename(rd.target.root) } / hg-review - - - - - -
-

${ basename(rd.target.root) }

- -

Changesets

- - $for ctx in revs: - $ ctx_node = ctx.node() - $ ctx_node_short = node_short(ctx_node) - $ ctx_comments = rd[ctx_node].comments - $ ctx_signoffs = rd[ctx_node].signoffs - - - - - -
${ ctx.rev() }:${ ctx_node_short } - ${ ctx.description() } - ${ len(ctx_comments) } comments, - ${ len(ctx_signoffs) } signoffs
-
- - \ No newline at end of file +

Changesets

+ + $for ctx in revs: + $ ctx_node = ctx.node() + $ ctx_node_short = node_short(ctx_node) + $ ctx_comments = rd[ctx_node].comments + $ ctx_signoffs = rd[ctx_node].signoffs + + + + + +
${ ctx.rev() }:${ ctx_node_short } + ${ ctx.description() } + ${ len(ctx_comments) } comments, + ${ len(ctx_signoffs) } signoffs
\ No newline at end of file diff -r 78cd41b87ea2 -r efc3c9173ce1 review/web_templates/review.html --- a/review/web_templates/review.html Tue Oct 13 21:12:15 2009 -0400 +++ b/review/web_templates/review.html Wed Oct 14 19:06:00 2009 -0400 @@ -1,34 +1,17 @@ $def with (rd, rcset) - + +$ ctx = rd.target[rcset.node] +

Changeset ${ ctx.rev() }: ${ ctx.description() }

- - - ${ basename(rd.target.root) } / hg-review - - - - - -
-

${ basename(rd.target.root) }

- - $ ctx = rd.target[rcset.node] -

Changeset ${ ctx.rev() }: ${ ctx.description() }

- - $for filename, diff in rcset.diffs().iteritems(): -

${ filename }

-
- - $ max_line = diff['max'] - $ content = diff['content'] - $for n, line in content: - $ kind = 'rem' if line[0] == '-' else 'add' if line[0] == '+' else '' - - - -
${ line[1:] or ' ' }
-
-
- - \ No newline at end of file +$for filename, diff in rcset.diffs().iteritems(): +

${ filename }

+
+ + $ max_line = diff['max'] + $ content = diff['content'] + $for n, line in content: + $ kind = 'rem' if line[0] == '-' else 'add' if line[0] == '+' else '' + + + +
${ line[1:] or ' ' }
\ No newline at end of file diff -r 78cd41b87ea2 -r efc3c9173ce1 review/web_ui.py --- a/review/web_ui.py Tue Oct 13 21:12:15 2009 -0400 +++ b/review/web_ui.py Wed Oct 14 19:06:00 2009 -0400 @@ -29,7 +29,14 @@ LOG_PAGE_LEN = 15 +def render_in_base(fn): + def _fn(*args, **kwargs): + content = fn(*args, **kwargs) + return render.base(_rd, content) + return _fn + class index: + @render_in_base def GET(self): rev_max = _rd.target['tip'].rev() rev_min = rev_max - LOG_PAGE_LEN if rev_max >= LOG_PAGE_LEN else 0 @@ -38,6 +45,7 @@ class review: + @render_in_base def GET(self, node_short): return render.review(_rd, _rd[node_short])