{% extends "template.html" %}
{% load cmtags %}
{% block extrahead %}
<link rel="stylesheet" type="text/css" href="/static/css/diff.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>Diff</li>{%endblock%}
{% block content %}
<h1>Diff: {{o.handler_class_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>From Revision</b></TD><TD>{{r1}}</TD></TR>
        <TR><TD><b>To Revision</b></TD><TD>{{r2}}</TD></TR>
        <TR><TD><b>Categories</b></TD><TD>{% for c in o.categories.all %} {{c}} {% endfor %}</TD></TR>
        <TR><TD><b>Preview Mode</b></TD><TD>
            <form>
                <select onchange="location = this.options[this.selectedIndex].value;">
                    <option value="{% cm_url diff_rev o.id 'u' r1 r2 %}" {%ifequal mode "u"%} selected{% endifequal %}>Unified Diff</option>
                    <option value="{% cm_url diff_rev o.id '2' r1 r2 %}" {%ifequal mode "2"%} selected{% endifequal %}>Side-by-side</option>
                </select>
            </form>
        </TD></TR>
    </TABLE>
</DIV>
<DIV CLASS="module">
    <TABLE SUMMARY="Diff" WIDTH="100%">
        <CAPTION>Diff</CAPTION>
        <TR><TD>{{diff|safe}}</TD></TR>
    </TABLE>
    {%ifequal mode "2"%}
        <B>Legend:</B><BR/>
        <SPAN class="diff_add">&nbsp;&nbsp;</SPAN> Added<br/>
        <SPAN class="diff_sub">&nbsp;&nbsp;</SPAN> Removed<br/>
        <SPAN class="diff_chg">&nbsp;&nbsp;</SPAN> Modified
    {% endifequal %}
</DIV>

<DIV CLASS="module">
    <FORM METHOD="POST" ACTION="{% cm_url diff o.id %}">{% csrf_token %}
    <TABLE SUMMARY="Revisions" WIDTH="100%">
        <CAPTION>Revisions</CAPTION>
        {% for rev in o.revisions %}
            <TR>
                <TD><A HREF="{% cm_url view_revision o.id rev.revision %}">{{rev.revision}}</A></TD>
                <TD><A HREF="{% cm_url view_revision o.id rev.revision %}">{{rev.date}}</a></TD>
                <TD><INPUT TYPE="radio" NAME="r1" ID="r1{{rev.revision}}" VALUE="{{rev.revision}}" {% ifequal rev.revision r1 %}checked{%endifequal%}/></TD>
                <TD><INPUT TYPE="radio" NAME="r2" ID="r2{{rev.revision}}" VALUE="{{rev.revision}}" {% ifequal rev.revision r2 %}checked{%endifequal%}/></TD>
            </TR>
        {% endfor %}
    </TABLE>
    <INPUT TYPE="submit" VALUE="Diff">
    </FORM>
</DIV>
{%endblock%}
