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 @register.filter
@stringfilter @stringfilter
def lines(value): def lines(value):
return value.split('\n') return value.split('\n')[:-1]
@register.filter @register.filter
@stringfilter @stringfilter

View file

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

View file

@ -6,7 +6,15 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h2>Blob View</h2> <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"> <table class="diff">
{% for line in blob.data|lines %} {% for line in blob.data|lines %}
<tr> <tr>
@ -15,5 +23,8 @@
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>
{% else %}
<em>File is empty</em>
{% endif %}
{% include "browser/commitlog.html" %} {% include "browser/commitlog.html" %}
{% endblock %} {% endblock %}