review/web_templates/review.html @ 0a9effb274b0 webui

Add review-level comments.
author Steve Losh <steve@stevelosh.com>
date Wed, 14 Oct 2009 20:30:36 -0400
parents 93baa16777e9
children c48a619ef5db
$def with (rd, rcset)

$ ctx = rd.target[rcset.node]
<h2>Changeset ${ ctx.rev() }: ${ ctx.description() }</h2>

$ review_level_comments = filter(lambda c: not c.filename, rcset.comments)
$for comment in review_level_comments:
    <div class="comment">
        <div class="avatar"><img height="52" width="52" src="http://www.gravatar.com/avatar/${ md5(email(comment.author)).hexdigest() }?s=52"/></div>
        <div>
            <div class="author"><a href="mailto:${ email(comment.author) }">${ templatefilters.person(comment.author) }</a> said:</div>
            <div class="message">${ comment.message }</div>
        </div>
    </div>

$for filename, diff in rcset.diffs().iteritems():
    <h3>${ filename }</h3>
    <div class="diff">
        <table>
            $ max_line = diff['max']
            $ content = diff['content']
            $ line_level_comments = filter(lambda c: c.filename == filename, rcset.comments)
            $for n, line in content:
                $ kind = 'rem' if line[0] == '-' else 'add' if line[0] == '+' else ''
                <tr class="${ kind }">
                    <td class="diff-line"><code>${ line[1:] or ' ' }</code></td>
                </tr>
                $ line_comments = filter(lambda c: max(c.lines) == n, line_level_comments)
                $for comment in line_comments:
                    <tr><td class="comment">
                        <div class="avatar"><img height="52" width="52" src="http://www.gravatar.com/avatar/${ md5(email(comment.author)).hexdigest() }?s=52"/></div>
                        <div>
                            <div class="author"><a href="mailto:${ email(comment.author) }">${ templatefilters.person(comment.author) }</a> said:</div>
                            <div class="message">${ comment.message }</div>
                        </div>
                    </td></tr>
        </table>