review/templates/changeset.html @ 17ad8036c6e2

web: yep, more styles
author Steve Losh <steve@stevelosh.com>
date Sun, 13 Jun 2010 00:20:55 -0400
parents 4a6d47faac16
children 191d8a0d6190
{% extends "base.html" %}

{% block id %}changeset{% endblock %}
{% block title %}Changeset {{ rev.rev() }} of {% endblock %}

{% block content %}
    <h2>Changeset {{ rev.rev() }}: {{ rev.description().splitlines()[0] }}</h2>

    {% if utils['len'](rev.description().splitlines()) > 1 %}
        <div class="fulldesc">{{ "\n".join(rev.description().splitlines()[1:]).strip() }}</div>
    {% endif %}

    {% with %}
        {% set comments = rcset.review_level_comments() %}

        {% if comments %}
            <div class="review-level-comments item-listing">
                {% for comment in comments %}
                    <div class="comment group">
                        {{ 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 %}
            </div>
        {% else %}
            <p class="placeholder">No changeset-level comments yet&hellip;</p>
        {% endif %}
    {% endwith %}

    {% if not read_only %}
        <div class="add-review-comment togglebox group">
            <span class="activate"><a class="button" href="#"><span>Add a comment on this changeset</span></a></span>
            <form class="disabled" id="comment-review-form" method="POST" action="">
                <div class="field">
                    <label class="infield" for="id_comment-review-form_body">Comment</label>
                    <textarea autocomplete="off" id="id_comment-review-form_body" cols="60" rows="6" name="new-comment-body"></textarea>
                </div>
                <a class="submit button" href="#"><span>Post Comment</span></a>
                <a class="cancel button" href="#"><span>Cancel</span></a>
            </form>
        </div>
    {% endif %}

    <h2>Signoffs</h2>

    {% with %}
        {% set signoffs = rcset.signoffs %}

        {% if signoffs %}
            <div class="signoffs item-listing">
                {% for signoff in signoffs %}
                    <div class="signoff group {{ signoff.opinion or 'neutral' }}">
                        {{ macros.gravatar(signoff, utils) }}
                        <div class="signoff-opinion {{ signoff.opinion or "neutral" }}">{{ signoff.opinion or "meh" }}</div>
                        
                        <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 %}
            </div>
        {% else %}
            <p class="placeholder">No signoffs yet&hellip;</p>
        {% endif %}
    {% endwith %}

    {% if not read_only %}
        <div class="add-signoff togglebox group">
            <span class="activate">
                {% if cu_signoff %}
                    <a class="button" href="#"><span>Change your signoff</span></a>
                {% else %}
                    <a class="button" href="#"><span>Sign off on this changeset</span></a>
                {% endif %}
            </span>
            <form id="signoff-form" class="disabled" method="POST" action="">
                <p class="sign-off-as">Sign off as:</p>
                <div class="field">
                    <input id="id_signoff-form_yes" type="radio" name="signoff" value="yes" {% if cu_signoff and cu_signoff.opinion == 'yes' %}checked{% endif %}/><label class="radio" for="id_signoff-form_yes">Yes</label>
                    <input id="id_signoff-form_no"type="radio" name="signoff" value="no" {% if cu_signoff and cu_signoff.opinion == 'no' %}checked{% endif %}/><label class="radio" for="id_signoff-form_no">No</label>
                    <input id="id_signoff-form_neutral"type="radio" name="signoff" value="neutral" {% if cu_signoff and cu_signoff.opinion == '' %}checked{% endif %}/><label class="radio" for="id_signoff-form_neutral">Neutral</label>
                </div>
                <div class="field">
                    <label class="infield" for="id_signoff-form_body">Signoff message</label>
                    <textarea autocomplete="off" id="id_signoff-form_body" cols="60" rows="6" name="new-signoff-body">{% if cu_signoff %}{{ cu_signoff.message }}{% endif %}</textarea>
                </div>
                <a class="submit button" href="#"><span>Add Signoff</span></a>
                <a class="cancel button" href="#"><span>Cancel</span></a>
            </form>
        </div>
    {% endif %}

    <h2>Files</h2>

    {% for filename in rcset.files() %}
        <div class="file">
            <div class="filename group">
                <h3><a class="fold" href="#">{{ filename }}</a> <span class="status">&darr;</span> </h3>
            </div>

            <div class="file-review-contents">
                {% with %}
                    {% set comments = rcset.file_level_comments(filename) %}

                    {% if comments %}
                        <div class="comments item-listing">
                            {% for comment in comments %}
                                <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 %}
                        </div>
                    {% endif %}
                {% endwith %}
                {% if not read_only %}
                    <div class="add-file-comment togglebox group">
                        <span class="activate"><a class="button" href=""><span>Add a comment on this file</span></a></span>

                        <form id="id_comment-file-form_{{ loop.index }}" class="disabled" method="POST" action="">
                            <div class="field">
                                <label class="infield" for="id_comment-file-form_{{ loop.index }}_body">Comment</label>
                                <textarea autocomplete="off" id="id_comment-file-form_{{ loop.index }}_body" cols="60" rows="6" name="new-comment-body"></textarea>
                            </div>

                            <a class="submit button" href="#"><span>Post Comment</span></a>
                            <a class="cancel button" href="#"><span>Cancel</span></a>

                            <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 %}