{% extends "template.html" %}
{% load cmtags %}
{% block extrahead %}
<link rel="stylesheet" type="text/css" href="/media/css/changelists.css" />
<link rel="stylesheet" type="text/css" href="/static/css/pygments.css" />
<link rel="stylesheet" type="text/css" href="/static/css/highlight.css" />
{% endblock %}
{% block breadcrumbs %}{{block.super}}<li>{{o.repo_path}}</li>{% endblock %}
<{% block content %}
<ul class="object-tools">
    {% if annotate %}
    <li><a href="{% cm_url view o.id %}">View</a></li>
    {% endif %}
    {% if content %}
    <li><a href="{% cm_url annotate o.id %}">Annotate</a></li>
    {% endif %}
    <li><a href="{% if r.revision %}{% cm_url view_text_revision o.id r.revision %}{% else %}{% cm_url view_text o.id %}{% endif %}">Plain Text</a></li>
</ul>

<h1>{{o.verbose_name}}: {{o.repo_path}}</h1>
<DIV CLASS="module">
    <TABLE SUMMARY="Object info" WIDTH="100%">
        <CAPTION>Object info</CAPTION>
        <TR><TD WIDTH="100px"><b>ID</b></TD><TD>{{o.id}}</TD></TR>
        <TR><TD><b>Repo Path</b></TD><TD>{{o.repo_path}}</TD></TR>
        <TR><TD><b>Revision</b></TD><TD>{{r.revision}}</TD></TR>
        <TR><TD><b>Modified</b></TD><TD>{{r.date}}</TD></TR>
        <TR><TD><b>Categories</b></TD><TD>{% for c in o.categories.all %} {{c}} {% endfor %}</TD></TR>
    </TABLE>
</DIV>
{% if annotate %}
<style>
.a-rev {
    width: 30px;
    margin: 0 4pt 0 0;
    padding: 1px 3px 1px 0;
    text-align: right;
    -webkit-user-select: none;
    border-right: 1px solid #d7d7d7;
    border-bottom: 1px solid #998;
    background: #eee;
    color: #999;
}

.a-date {
    width: 135px;
    margin: 0 4pt 0 0;
    padding: 1px 3px 1px 0;
    text-align: right;
    -webkit-user-select: none;
    border-right: 1px solid #d7d7d7;
    border-bottom: 1px solid #998;
    background: #eee;
    color: #999;
}

.a-text {
    white-space: pre;
    font-family: monospace;
}

</style>
{% endif %}
<DIV CLASS="module">
    <TABLE SUMMARY="Content" WIDTH="100%">
        <CAPTION>Content</CAPTION>
        <TR><TD>{% if content %}{{content|safe}}{% endif %}{% if annotate %}
            <table border="1" width="100%">
                <thead>
                    <tr><th>Rev</th><th>Date</th><th>Text</th></tr>
                </thead>
            {% for s,ar,l in annotate %}
                <tr class="{{s}}">
                    <td class="a-rev"><a href="{% cm_url view_revision o.id ar.revision %}">{{ar.revision}}</a></td>
                    <td class="a-date"><a href="{% cm_url view_revision o.id ar.revision %}">{{ar.date}}</a></td>
                    <td class="a-text">{{l}}</td>
                </tr>
            {% endfor %}
            </table>
        {%endif%}</TD></TR>
    </TABLE>
</DIV>

<DIV CLASS="module">
    <FORM METHOD="POST" ACTION="{% cm_url diff o.id %}">{% csrf_token %}
    <TABLE SUMMARY="Revisions" WIDTH="100%">
        <CAPTION>Revisions</CAPTION>
        <TBODY>
        {% for rev in o.revisions %}
            <TR class={% ifequal r.revision rev.revision %}"selected"{% else %}"{%cycle 'row1' 'row2'%}"{% endifequal %}>
                <TD WIDTH="50px"><A HREF="{% cm_url view_revision o.id rev.revision %}">{{rev.revision}}</A></TD>
                <TD WIDTH="200px"><A HREF="{% cm_url view_revision o.id rev.revision %}">{{rev.date}}</A></TD>
                <TD WIDTH="50px"><INPUT TYPE="radio" NAME="r1" ID="r1{{rev.revision}}" VALUE="{{rev.revision}}"/></TD>
                <TD><INPUT TYPE="radio" NAME="r2" ID="r2{{rev.revision}}" VALUE="{{rev.revision}}"/></TD>
            </TR>
        {% endfor %}
        </TBODY>
    </TABLE>
    <INPUT TYPE="submit" VALUE="Diff">
    </FORM>
</DIV>
{%endblock%}
