Moved diff template to its own component

This commit is contained in:
Correl Roush 2010-12-02 10:08:50 -05:00
parent 4568c60956
commit 8183b0c928
2 changed files with 25 additions and 22 deletions

View file

@ -33,28 +33,7 @@
<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 %}
</caption>
{% 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>
{% include "components/diff.html" %}
{% endfor %}
</div>
</div>

View file

@ -0,0 +1,24 @@
<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 %}
</caption>
{% 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>
{% block annotations %}
{% endblock %}
{% endif %}
{% endfor %}
</table>