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