Massive tree action speedup
[catagits/Gitalist.git] / root / fragment / ref / tree.tt2
CommitLineData
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 %]>
5dc23a14 7 <[% cell %]>Message</[% cell %]>
0da7966e 8 </tr>
1f9a47c2 9[% END %]
97bdf7bc 10[%-
11 SET counter = 1;
fe89796b 12
97bdf7bc 13 # sort files and folders
14 SET tree_files = [];
15 SET tree_folders = [];
eb8ee28a 16 FOREACH item IN entries;
17 IF item.mode != "40000";
97bdf7bc 18 tree_files.push(item);
19 ELSE;
20 tree_folders.push(item);
21 END;
22 END;
23%]
24
25[% BLOCK output_tree %]
eb8ee28a 26 [% FOREACH item IN tree_type.sort('filename') %]
97bdf7bc 27 <tr [% "class='invert'" IF counter % 2 %]>
eb8ee28a 28 <td class='file-mode'>[% c.stash.mode_string(item.mode) %]</td>
97bdf7bc 29 [%-
eb8ee28a 30 action_type = item.mode == '40000' ? 'tree' : 'blob';
31 action_for_link = item.mode == '40000' ? '/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.filename))
97bdf7bc 33 -%]
eb8ee28a 34 <td class="file-name"><a href="[% blob_or_tree_link %]" class="[% item.mode == '40000' ? 'folder' : 'file' %]">[% item.filename %]</a></td>
97bdf7bc 35 <td class='action-list'>
eab82ed1 36 <a href="[% blob_or_tree_link %]">[% theact %]</a>
eb8ee28a 37 [% IF item.mode != '40000' %]
38 <a href="[% c.uri_for_action('/ref/blob', c.req.captures, c.req.args.to_path(item.filename)) %]" 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.filename)) %]" 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.filename)) %]" title="Blame" class="button blame">blame</a>
0da7966e 41 [% END %]
eb8ee28a 42 <a href="[% c.uri_for_action('/ref/history', c.req.captures, c.req.args.to_path(item.filename)) %]" title="History (Short log)" class="button shortlog">Short log</a>
97bdf7bc 43 </td>
eb8ee28a 44 <td class="message"><span class='js-data'>[% c.req.args.to_path(item.filename) %]</span>Loading commit info ...</td>
97bdf7bc 45 </tr>
46 [% counter = counter + 1 %]
47 [% END %]
48[% END %]
49
5dc23a14 50<table class="listing" id="commit-tree">
97bdf7bc 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>
0da7966e 56</table>
feb6e881 57
4a0a2afa 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>