{% extends "layouts/default.html" %}
{% load gravatar %}
{% load vcs %}

{% block content %}
<h2>{{ commit.message|oneline }}</h2>

<dl>
    <dt>Committer</dt>
    <dd>
        <img src="{{ commit.author_email|gravatar:32 }}" />
        {{ commit.committer }}
    </dd>
    <dt>Committed</dt>
    <dd>{{ commit.committed_date }}</dd>
    <dt>Author</dt>
    <dd>
        <img src="{{ commit.author_email|gravatar:32 }}" />
        {{ commit.author }}
    </dd>
    <dt>Written</dt>
    <dd>{{ commit.authored_date }}</dd>
    <dt>Message</dt>
    <dd>
        {{ commit.message }}
    </dd>
</dl>

<div class="diff-container">
    <div class="diff-html">
        {% for diff in diffs %}
            <table class="diff">
                <caption>
                    {% if diff.a %}{{ diff.a.path }}{% else %}(New File){% endif %}
                    {% if diff.a.path != diff.b.path %}
                        =>
                        {% if diff.b %}{{ diff.b.path }}{% else %}(Deleted){% endif %}
                    {% endif %}
                {% for change in diff.changes %}
                    {% if change.type == '@' %}
                        <tr class="break">
                            <td colspan="3">{{ change.text }}</td>
                        </tr>
                    {% else %}
                        <tr class="{% if change.type == '+' %}add{% endif %}{% if change.type == '-' %}del{% endif %}">
                            <td class="number">{% if change.type != '+' %}{{ change.line_a }}{% endif %}</td>
                            <td class="number">{% if change.type != '-' %}{{ change.line_b }}{% endif %}</td>
                            <td class="text">{{ change.text }}</td>
                        </tr>
                    {% endif %}
                {% endfor %}
            </table>
        {% endfor %}
    </div>
</div>
{% endblock %}