Files
GitList/views/commit.twig
Klaus Silveira 60d07d15ee Merge pull request #101 from danielgtaylor/line-numbers
Show line numbers for diffs in the commit view
2012-07-20 21:19:37 -07:00

56 lines
2.3 KiB
Twig

{% extends 'layout_page.twig' %}
{% set page = 'commits' %}
{% block title %}GitList{% endblock %}
{% block content %}
{% include 'breadcrumb.twig' with {breadcrumbs: [{dir: "Commit #{commit.hash}", path:''}]} %}
<div class="commit-view">
<div class="commit-header">
<span class="pull-right"><a class="btn btn-small" href="{{ path('branch', {repo: repo, branch: commit.hash}) }}" title="Browse code at this point in history"><i class="icon-list-alt"></i> Browse code</a></span>
<h4>{{ commit.message }}</h4>
</div>
<div class="commit-body">
<img src="http://gravatar.com/avatar/{{ commit.author.email | md5 }}?s=32" class="pull-left space-right" />
<span><a href="mailto:{{ commit.author.email }}">{{ commit.author.name }}</a> authored in {{ commit.date | date('d/m/Y \\a\\t H:i:s') }}<br />Showing {{ commit.changedFiles }} changed files</span>
</div>
</div>
<ul class="commit-list">
{% for diff in commit.diffs %}
<li><i class="icon-file"></i> <a href="#{{ loop.index }}">{{ diff.file }}</a> <span class="meta pull-right">{{ diff.index }}</span></li>
{% endfor %}
</ul>
{% for diff in commit.diffs %}
<div class="source-view">
<div class="source-header">
<div class="meta"><a name="{{ loop.index }}">{{ diff.file }}</div>
<div class="btn-group pull-right">
<a href="{{ path('commits', {repo: repo, branch: commit.hash, file: diff.file}) }}" class="btn btn-small"><i class="icon-list-alt"></i> History</a>
<a href="{{ path('blob', {repo: repo, branch: commit.hash, file: diff.file}) }}" class="btn btn-small"><i class="icon-file"></i> View file @ {{ commit.shortHash }}</a>
</div>
</div>
<div class="source-diff">
<table>
{% for line in diff.getLines %}
<tr>
<td class="lineNo">{{ line.getNumOld }}</td>
<td class="lineNo">{{ line.getNumNew }}</td>
<td style="width: 100%">
<pre{% if line.getType %} class="{{ line.getType }}"{% endif %}>{{ line.getLine }}</pre>
</td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endfor %}
<hr>
{% endblock %}