Fix links in tree view to not point at fragments
[catagits/Gitalist.git] / root / fragment / commit / tree.tt2
1 [% BLOCK tree_table_headfoot %]
2   <tr>
3    <th>mode</th>
4    <th>file</th>
5    <th>actions</th>
6   </tr>
7 [% END %]
8 <table class='tree listing'>
9  <thead>
10     [% PROCESS tree_table_headfoot %]
11  </thead>
12  <tfoot>
13     [% PROCESS tree_table_headfoot %]
14  </tfoot>
15
16  <tbody>
17   [% FOREACH item IN tree_list %]
18   <tr>
19    <td class='file-mode'>[% item.modestr %]</td>
20    [%-
21         action_type = item.type == 'tree' ? 'tree' : 'blob';
22         action_for_link = item.type == 'tree' ? c.action : c.controller.action_for('blob');
23         blob_or_tree_link = c.uri_for(action_for_link, c.req.captures, c.req.args.to_path(item.file))
24    -%]
25    <td class='file-name'>
26     <a href="[% blob_or_tree_link %]">[% item.file %]</a>
27    </td>
28    <td class='action-list'>
29      <a href="[% blob_or_tree_link %]">[% theact %]</a>
30           [% IF item.type == 'blob' %]
31           <a href="[% c.uri_for_action('/commit/blame', c.req.captures, c.req.args.to_path(item.file)) %]">blame</a>
32           [% END %]
33      <a href="[% c.uri_for_action('/commit/history', c.req.captures, c.req.args.to_path(item.file)) %]">history</a>
34      [% IF item.type == 'blob' %]
35      <a href="[% c.uri_for_action('/commit/raw', c.req.captures, c.req.args.to_path(item.file)) %]">raw</a>
36      [% END %]
37    </td>
38   </tr>
39   [% END %]
40  </tbody>
41 </table>