review/templates/changeset.html @ b45d0345f936 flask

More cleanup.
author Steve Losh <steve@stevelosh.com>
date Fri, 11 Jun 2010 20:59:24 -0400
parents 776a8c6e70a0
children fcbf8d764330
{% extends "base.html" %}

{% block title %} at {{ title }}{% endblock %}
{% block header %} at {{ title }}{% endblock %}

{% block content %}
    <h2>Changeset {{ rev.rev() }}: {{ rev.description().splitlines()[0] }}</h2>
    
    {% for comment in rcset.review_level_comments() %}
        <div class="comment">
            {{ macros.gravatar(comment, utils) }}
            <div>
                <div class="author">
                    <a href="mailto:${ email(comment.author) }">{{ utils['templatefilters'].person(comment.author) }}</a>
                    said:
                </div>
                <div class="message">{{ comment.message }}</div>
            </div>
        </div>
    {% endfor %}
    
    {% if not read_only %}
        <div id="comment-review" class="input">
            <p class="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="new-comment-body"></textarea>
                </div>
                <div class="buttons">
                    <input type="submit" class="button" value="Submit" />
                    <span class="cancel"><a href="#">Cancel</a></span>
                </div>
            </form>
        </div>
    {% endif %}
    
    <h2>Signoffs</h2>
    
    {% for signoff in rcset.signoffs %}
        <div class="signoff {{ signoff.opinion or 'neutral' }}">
            {{ macros.gravatar(signoff, utils) }}
            <div>
                <div class="author">
                    <a href="mailto:${ email(signoff.author) }">{{ utils['templatefilters'].person(signoff.author) }}</a>
                    signed off as <span class="opinion">{{ signoff.opinion or "neutral" }}</span> on this changeset, saying:
                </div>
                <div class="message">{{ signoff.message }}</div>
            </div>
        </div>
    {% endfor %}
    
    {% if not read_only %}
        <div id="signoff-review" class="input">
            <p class="activate">
                {% if cu_signoff %}
                    <a href="#">Change your signoff</a>
                {% else %}
                    <a href="#">Sign off on this changeset</a>
                {% endif %}
            </p>
            <form id="signoff-review-form" method="post" action="">
                <div class="field">
                    <input type="radio" name="signoff" value="yes" {% if cu_signoff and cu_signoff.opinion == 'yes' %}checked{% endif %}/><span>Yes</span>
                    <input type="radio" name="signoff" value="no" {% if cu_signoff and cu_signoff.opinion == 'no' %}checked{% endif %}/><span>No</span>
                    <input type="radio" name="signoff" value="neutral" {% if cu_signoff and cu_signoff.opinion == '' %}checked{% endif %}/><span>Neutral</span>
                </div>
                <div class="field">
                    <label for="body">Signoff message:</label>
                    <textarea cols="60" rows="6" name="new-signoff-body">{% if cu_signoff %}{{ cu_signoff.message }}{% endif %}</textarea>
                </div>
                <div class="buttons">
                    <input type="submit" class="button" value="Submit" />
                    <span class="cancel"><a href="#">Cancel</a></span>
                </div>
            </form>
        </div>
    {% endif %}

    <h2>Files</h2>
    
    {% for filename in rcset.files() %}
        <div class="file-review">
            <div class="filename-header">
                <a class="fold-file" href="">&nbsp;&nbsp;&nbsp;&darr;</a>
                <h3>{{ filename }}</h3>
            </div>
            
            <div class="file-review-contents">
                {% for comment in rcset.file_level_comments(filename) %}
                    <div class="comment">
                        {{ macros.gravatar(comment, utils) }}
                        <div>
                            <div class="author">
                                <a href="mailto:{{ utils['email'](comment.author) }}">
                                    {{ utils['templatefilters'].person(comment.author) }}</a>
                                    said:
                            </div>
                            <div class="message">{{ comment.message }}</div>
                        </div>
                    </div>
                {% endfor %}
                
                {% if not read_only %}
                    <div id="comment-file" class="input">
                        <p class="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="new-comment-body"></textarea>
                            </div>
                            <div class="buttons">
                                <input type="submit" class="button" value="Submit" />
                                <span class="cancel"><a href="#">Cancel</a></span>
                            </div>
                            <input type="hidden" name="filename" value="{{ filename }}" />
                        </form>
                    </div>
                {% endif %}
                
                <div class="diff">
                    <table>
                        <tbody>
                            {% set annotated_diff = rcset.annotated_diff(filename) %}
                            {# We need to ignore the first item from this generator, because
                               we don't care about providing a line-number prefix (for now!). #}
                            {% set ignore_this_variable = annotated_diff.next() %}
                            
                            {% for line in annotated_diff %}
                                {% if line['skipped'] %}
                                    <tr class="skipped">
                                        <td><code>&hellip; skipped {{ line['skipped'] }} lines &hellip;</code></td>
                                    </tr>
                                    {% for comment in line['comments'] %}
                                        <tr><td class="comment">
                                            {{ macros.gravatar(comment, utils) }}
                                            <div>
                                                <div class="author">
                                                    <a href="mailto:{{ utils['email'](comment.author) }}">
                                                        {{ utils['templatefilters'].person(comment.author) }}
                                                    </a>
                                                    said (on a skipped line):
                                                </div>
                                                <div class="message">{{ comment.message|escape }}</div>
                                            </div>
                                        </td></tr>
                                    {% endfor %}
                                {% else %}
                                    <tr class="{{ utils['line_type'](line['content']) }}{% if not read_only %} commentable {% endif %}">
                                        <td class="diff-line"><div class="line-data"><span class="linenumber">{{ line['number'] }}</span><span class="filename">{{ filename }}</span></div><code>{{ line['number'] }}: {{ line['content'][1:]|escape }}</code></td>
                                    </tr>
                                        
                                    {% for comment in line['comments'] %}
                                        <tr><td class="comment">
                                            {{ macros.gravatar(comment, utils) }}
                                            <div>
                                                <div class="author">
                                                    <a href="mailto:{{ utils['email'](comment.author) }}">
                                                        {{ utils['templatefilters'].person(comment.author) }}
                                                    </a>
                                                    said:
                                                </div>
                                                <div class="message">{{ comment.message }}</div>
                                            </div>
                                        </td></tr>
                                    {% endfor %}
                                {% endif %}
                            {% endfor %}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    {% endfor %}
{% endblock %}