mirror of
https://github.com/klaussilveira/gitlist.git
synced 2025-11-17 19:20:56 +01:00
With each new hunk, starting new line number was the same as starting old line number. Parse diff line a bit further to get real new line number. Fix HREFs for old line number links in both bootstrap3 and default themes so that thay work.
78 lines
3.2 KiB
Twig
78 lines
3.2 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-default btn-sm" href="{{ path('branch', {repo: repo, branch: commit.hash}) }}" title="Browse code at this point in history"><span class="fa fa-list-alt"></span> Browse code</a></span>
|
|
<h4>{{ commit.message }}</h4>
|
|
</div>
|
|
<div class="commit-body">
|
|
{% if commit.body is not empty %}
|
|
<p>{{ commit.body | nl2br }}</p>
|
|
{% endif %}
|
|
<img src="https://gravatar.com/avatar/{{ commit.author.email | lower | md5 }}?s=32" class="pull-left space-right" />
|
|
<span><a href="mailto:{{ commit.author.email }}">{{ commit.author.name }}</a> authored on {{ commit.date | format_date }}<br />Showing {{ commit.changedFiles }} changed files</span>
|
|
</div>
|
|
</div>
|
|
|
|
<ul class="commit-list">
|
|
{% for diff in commit.diffs %}
|
|
<li><i class="fa fa-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, commitishPath: commit.hash ~ '/' ~ diff.file}) }}" class="btn btn-default btn-sm"><span class="fa fa-list-alt"></span> History</a>
|
|
<a href="{{ path('blob', {repo: repo, commitishPath: commit.hash ~'/' ~ diff.file}) }}" class="btn btn-default btn-sm"><span class="fa fa-file"></span> View file @ {{ commit.shortHash }}</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="source-diff">
|
|
<table>
|
|
{% for line in diff.getLines %}
|
|
<tr>
|
|
<td class="lineNo">
|
|
{% if line.getType != 'chunk' %}
|
|
<a name="L{{ loop.index }}R{{ line.getNumOld }}"></a>
|
|
<a href="#L{{ loop.index }}R{{ line.getNumOld }}">
|
|
{% endif %}
|
|
{{ line.getNumOld }}
|
|
{% if line.getType != 'chunk' %}
|
|
</a>
|
|
{% endif %}
|
|
</td>
|
|
<td class="lineNo">
|
|
{% if line.getType != 'chunk' %}
|
|
<a name="L{{ loop.index }}L{{ line.getNumNew }}"></a>
|
|
<a href="#L{{ loop.index }}L{{ line.getNumNew }}">
|
|
{% endif %}
|
|
{{ line.getNumNew }}
|
|
{% if line.getType != 'chunk' %}
|
|
</a>
|
|
{% endif %}
|
|
</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 %}
|