Prettied up the blob view

This commit is contained in:
Correl Roush 2010-11-22 15:44:13 -05:00
parent 6c34163c70
commit 9a3e32c612
3 changed files with 26 additions and 10 deletions

View file

@ -13,7 +13,7 @@ def oneline(value):
@register.filter
@stringfilter
def lines(value):
return value.split('\n')
return value.split('\n')[:-1]
@register.filter
@stringfilter

View file

@ -70,6 +70,11 @@ table.diff .break {
}
table.diff .number {
width: 3em;
text-align: right;
background-color: #f0f0f0;
}
table.diff .text {
border-left: 1px solid #e0e0e0;
}
table.diff .add .number {
background-color: #baeeba;

View file

@ -6,14 +6,25 @@
{% endblock %}
{% block content %}
<h2>Blob View</h2>
<table class="diff">
{% for line in blob.data|lines %}
<tr>
<td class="number">{{ forloop.counter }}</td>
<td class="text">{{ line }}</td>
</tr>
{% endfor %}
</table>
<h2>File Contents</h2>
{% with log|first as commit %}
<h3>
{{ blob.path|basename }}
@
<a href="{% url codereview.browser.views.view repository=repository ref=commit.id %}">{{ commit.id }}</a>
</h3>
{% endwith %}
{% if blob.data %}
<table class="diff">
{% for line in blob.data|lines %}
<tr>
<td class="number">{{ forloop.counter }}</td>
<td class="text">{{ line }}</td>
</tr>
{% endfor %}
</table>
{% else %}
<em>File is empty</em>
{% endif %}
{% include "browser/commitlog.html" %}
{% endblock %}