review/web_templates/review.html @ 5c274209a7ec webui

Merge the README changes and the review init.
author Steve Losh <steve@stevelosh.com>
date Wed, 21 Oct 2009 19:31:46 -0400
parents c5932df8f4a8
children 1cc8e18b1b43
$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>

<div id="comment-review">
    <p class="comment-activate"><a href="">Add a comment on this changeset</a></p>
    <form id="comment-review-form" method="post" action="">
        <div class="field">
            <label for="body">Add a comment on this changeset:</label>
            <textarea cols="60" rows="6" name="body"></textarea>
        </div>
         <div class="buttons">
            <input type="submit" class="button" value="Submit" />
         </div>
    </form>
</div>
    
$for filename, diff in rcset.diffs().iteritems():
    <div class="filename-header">
        <h3>${ filename }</h3>
    </div>
    
    $ file_level_comments = filter(lambda c: c.filename == filename and not c.lines, rcset.comments)
    $for comment in file_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>
    
    <div id="comment-file">
        <p class="comment-activate"><a href="">Add a comment on this file</a></p>
        <form id="comment-file-form" method="post" action="">
            <div class="field">
                <label for="body">Add a comment on this file:</label>
                <textarea cols="60" rows="6" name="body"></textarea>
            </div>
             <div class="buttons">
                <input type="submit" class="button" value="Submit" />
             </div>
             <input type="hidden" name="filename" value="${ filename }" />
        </form>
    </div>
    
    <div class="diff">
        <table>
            $ max_line = diff['max']
            $ content = diff['content']
            $ line_level_comments = filter(lambda c: c.filename == filename and c.lines, 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>
    </div>