e893febf260a2ffcb2a1f612e04be9f6ed229630
[catagits/Gitalist.git] / root / fragment / ref / tree.tt2
1 [% BLOCK tree_table_headfoot %]
2 [% SET cell = type == 'head' ? 'th' : 'td' %]
3   <tr>
4    <[% cell %]>Mode</[% cell %]>
5    <[% cell %]>Folder / File</[% cell %]>
6    <[% cell %]>Actions</[% cell %]>
7    <[% cell %]>Message</[% cell %]>
8   </tr>
9 [% END %]
10 [%-
11         SET counter         = 1;
12         
13         # sort files and folders
14         SET tree_files          = [];
15         SET tree_folders        = [];
16         FOREACH item IN tree_list;
17                 IF item.type == "blob";
18                         tree_files.push(item);
19                 ELSE;
20                         tree_folders.push(item);
21                 END;
22         END;
23 %]
24
25 [% BLOCK output_tree %]
26         [% FOREACH item IN tree_type.sort('file') %]
27         <tr [% "class='invert'" IF counter % 2 %]>
28                 <td class='file-mode'>[% item.modestr %]</td>
29           [%-
30                action_type     = item.type == 'tree' ? 'tree' : 'blob';
31                action_for_link = item.type == 'tree' ? '/ref/tree' : '/ref/blob';
32                blob_or_tree_link = c.uri_for_action(action_for_link, c.req.captures, c.req.args.to_path(item.file))
33           -%]
34                 <td class="file-name"><a href="[% blob_or_tree_link %]" class="[% item.type == 'blob' ? 'file' : 'folder' %]">[% item.file %]</a></td>
35                 <td class='action-list'>
36         <a href="[% blob_or_tree_link %]">[% theact %]</a>
37           [% IF item.type == 'blob' %]
38         <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>
39         <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>
40         <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>
41           [% END %]
42             <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>
43                 </td>
44           <td class="message"><span class='js-data'>[% c.req.args.to_path(item.file) %]</span>Loading commit info ...</td>
45         </tr>
46                 [% counter = counter + 1 %]
47         [% END %]
48 [% END %]
49
50 <table class="listing" id="commit-tree">
51 <thead>[% PROCESS tree_table_headfoot type = 'head' %]</thead>
52 <tbody>
53         [% INCLUDE output_tree tree_type => tree_folders %]
54         [% PROCESS output_tree tree_type => tree_files   %]
55 </tbody>
56 </table>
57
58 <span id='file_commit_info-uri' class='js-data'>[% c.uri_for_action('/fragment/ref/file_commit_info', [ Repository.name, Commit.sha1 ]) %]</span>
59 <span id='commit-uri' class='js-data'>[% c.uri_for_action('/ref/commit', [Repository.name, 'HEAD']) %]</span>