review/templates/diff.html @ 13b6260aed99

web: changeset page improvements
author Steve Losh <steve@stevelosh.com>
date Sun, 13 Jun 2010 15:40:19 -0400
parents cec804c97165
children daf7418e0d28
{% import 'macros.html' as macros %}

<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 colspan="3" class="skip">
                        &hellip; skipped {{ line['skipped'] }} lines &hellip;
                    </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 %}
                {% with %}
                    {% set line_type = utils['line_type'](line['content']) %}

                    <tr class="{{ line_type }} {% if not read_only or allow_anon %} commentable {% endif %} line-{{ line['number'] }}">
                        <td class="linenumber">{{ line['number'] }}</td>
                        <td class="addrem-{{ line_type }}">{% if line_type == 'add' %}+{% elif line_type == 'rem' %}-{% endif %}</td>
                        <td class="code"><code>{{ utils['decode'](line['content'][1:])|escape }}</code></td>
                    </tr>
                {% endwith %}

                {% with %}
                    {% set comments = line['comments'] %}

                    {% for comment in comments %}
                        <tr class="comment">
                            <td class="comment group" colspan="3">
                                <span class="commentlines disabled">{{ ','.join(utils['map'](utils['str'], comment.lines)) }}</span>
                                {{ 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 %}
                {% endwith %}
            {% endif %}
        {% endfor %}
    </tbody>
</table>

</div>