Proof of concept for #56388: add last commit msg to tre views.
[catagits/Gitalist.git] / root / fragment / ref / tree.tt2
CommitLineData
5dc23a14 1<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
2<script>
3// Wait for image requests to come back first - $(function() {
4$(window).load(function() {
5 $('#commit-tree .message').each(function() {
6 var cell = $(this);
7 var filename = cell.parent().find('.file-name').text();
8 $.getJSON('/fragment/Gitalist/[% Commit.sha1 %]/file_commit_info/'+filename, {}, function(commitInfo) {
9 cell.empty();
10 cell.html('<a href="/Gitalist/"'+commitInfo.sha1+'">'+commitInfo.comment+'</a>');
11 });
12 });
13});
14</script>
15
1f9a47c2 16[% BLOCK tree_table_headfoot %]
10938267 17[% SET cell = type == 'head' ? 'th' : 'td' %]
0da7966e 18 <tr>
eab82ed1 19 <[% cell %]>Mode</[% cell %]>
97bdf7bc 20 <[% cell %]>Folder / File</[% cell %]>
eab82ed1 21 <[% cell %]>Actions</[% cell %]>
5dc23a14 22 <[% cell %]>Message</[% cell %]>
0da7966e 23 </tr>
1f9a47c2 24[% END %]
97bdf7bc 25
97bdf7bc 26[%-
27 SET counter = 1;
28
29 # sort files and folders
30 SET tree_files = [];
31 SET tree_folders = [];
32 FOREACH item IN tree_list;
33 IF item.type == "blob";
34 tree_files.push(item);
35 ELSE;
36 tree_folders.push(item);
37 END;
38 END;
39%]
40
41[% BLOCK output_tree %]
42 [% FOREACH item IN tree_type.sort('file') %]
43 <tr [% "class='invert'" IF counter % 2 %]>
44 <td class='file-mode'>[% item.modestr %]</td>
45 [%-
46 action_type = item.type == 'tree' ? 'tree' : 'blob';
47 action_for_link = item.type == 'tree' ? '/ref/tree' : '/ref/blob';
48 blob_or_tree_link = c.uri_for_action(action_for_link, c.req.captures, c.req.args.to_path(item.file))
49 -%]
50 <td class="file-name"><a href="[% blob_or_tree_link %]" class="[% item.type == 'blob' ? 'file' : 'folder' %]">[% item.file %]</a></td>
51 <td class='action-list'>
eab82ed1 52 <a href="[% blob_or_tree_link %]">[% theact %]</a>
0da7966e 53 [% IF item.type == 'blob' %]
eab82ed1 54 <a href="[% c.uri_for_action('/ref/blob', c.req.captures, c.req.args.to_path(item.file)) %]" title="Blob" class="button blob">Blob</a>
55 <a href="[% c.uri_for_action('/ref/raw', c.req.captures, c.req.args.to_path(item.file)) %]" title="Raw" class="button raw">raw</a>
56 <a href="[% c.uri_for_action('/ref/blame', c.req.captures, c.req.args.to_path(item.file)) %]" title="Blame" class="button blame">blame</a>
0da7966e 57 [% END %]
97bdf7bc 58 <a href="[% c.uri_for_action('/ref/history', c.req.captures, c.req.args.to_path(item.file)) %]" title="History (Short log)" class="button shortlog">Short log</a>
59 </td>
5dc23a14 60 <td class="message">Loading commit info ...</td>
97bdf7bc 61 </tr>
62 [% counter = counter + 1 %]
63 [% END %]
64[% END %]
65
66
67
68
5dc23a14 69<table class="listing" id="commit-tree">
97bdf7bc 70<thead>[% PROCESS tree_table_headfoot type = 'head' %]</thead>
71<tbody>
72 [% INCLUDE output_tree tree_type => tree_folders %]
73 [% PROCESS output_tree tree_type => tree_files %]
74</tbody>
0da7966e 75</table>