forked from broquaint/Gitalist
/
blame.tt2
59 lines (52 loc) · 1.71 KB
/
blame.tt2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
[% PROCESS 'nav/actions.tt2' object = head %]
[% INCLUDE inc/syntax_highlight_css.tt2 %]
<div class='content'>
[% IF object.type == 'commit' %]
<div class='commit-message'>[% short_cmt(head.comment) %]</div>
[% END %]
[% INCLUDE 'nav/path.tt2' %]
<div id='blame'>
<table>
<thead>
<tr>
<th>author</th>
<th>date</th>
<th>sha1</th>
<th></th>
<th class='data'>data</th>
</tr>
</thead>
<tfoot>
<tr>
<td>author</td>
<td>date</td>
<td>sha1</td>
<td></td>
<td class='data'>data</td>
</tr>
</tfoot>
<tbody>
[% blame_lines = blob.split("\n") %]
[% FOR info IN blame %]
<tr class=''>
[%-
linecolour = info.commit.sha1.substr(0,6);
IF info.commit.sha1 != lastsha1;
styleinfo = " style='border-top: solid 3px #" _ linecolour _ ";'"; -%]
<td nowrap class='author'[% styleinfo %]>[% info.commit.author %]</td>
<td nowrap class='date'[% styleinfo %]>[% info.commit.author_dt.ymd %]</td>
<td nowrap class='commit-info chroma-hash'[% styleinfo %]><a title="[% info.commit.author %] on [% info.commit.author_dt %]" href='[% c.uri_for('commit', {h=info.commit.sha1}) %]'>[% linecolour %]</td>
[%- ELSE -%]
<td nowrap class='author'></td>
<td nowrap class='date'></td>
<td nowrap class='commit-info'></td>
[%- END -%]
<td nowrap class='lineno' id='l[% info.meta.lineno %]' style='border-right: solid 3px #[% linecolour %]; border-left: solid 3px #[% linecolour %];'><tt><a href='[% c.uri_for('blame', {h=info.commit.sha1,f=filename}) %]#l[% info.meta.orig_lineno %]'>[% info.meta.lineno %]</a></tt></td>
<td nowrap class='data'><pre>[% blame_lines.${loop.index} %]</pre></td>
[% lastsha1 = info.commit.sha1 %]
</tr>
[% END %]
</tbody>
</table>
</div>
</div>