Merge remote branch 'seveas/seveas/syntax_highlight'
[catagits/Gitalist.git] / root / fragment / ref / tree.tt2
index 4e0965e..f2d63a5 100755 (executable)
@@ -1,18 +1,3 @@
-<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
-<script>
-// Wait for image requests to come back first - $(function() {
-$(window).load(function() {
-  $('#commit-tree .message').each(function() {
-    var cell     = $(this);
-    var filename = cell.parent().find('.file-name').text();
-    $.getJSON('/fragment/Gitalist/[% Commit.sha1 %]/file_commit_info/'+filename, {}, function(commitInfo) {
-      cell.empty();
-      cell.html('<a href="/Gitalist/'+commitInfo.sha1+'/commit">'+commitInfo.comment+'</a> '+commitInfo.age);
-    });
-  });
-});
-</script>
-
 [% BLOCK tree_table_headfoot %]
 [% SET cell = type == 'head' ? 'th' : 'td' %]
   <tr>
@@ -22,15 +7,14 @@ $(window).load(function() {
    <[% cell %]>Message</[% cell %]>
   </tr>
 [% END %]
-
 [%-
        SET counter         = 1;
-       
+
        # sort files and folders
        SET tree_files          = [];
        SET tree_folders        = [];
-       FOREACH item IN tree_list;
-               IF item.type == "blob";
+       FOREACH item IN entries;
+               IF item.mode != "40000";
                        tree_files.push(item);
                ELSE;
                        tree_folders.push(item);
@@ -39,33 +23,30 @@ $(window).load(function() {
 %]
 
 [% BLOCK output_tree %]
-       [% FOREACH item IN tree_type.sort('file') %]
+       [% FOREACH item IN tree_type.sort('filename') %]
        <tr [% "class='invert'" IF counter % 2 %]>
-               <td class='file-mode'>[% item.modestr %]</td>
+               <td class='file-mode'>[% c.stash.mode_string(item.mode) %]</td>
          [%-
-              action_type = item.type == 'tree' ? 'tree' : 'blob';
-              action_for_link = item.type == 'tree' ? '/ref/tree' : '/ref/blob';
-              blob_or_tree_link = c.uri_for_action(action_for_link, c.req.captures, c.req.args.to_path(item.file))
+              action_type     = item.mode == '40000' ? 'tree' : 'blob';
+              action_for_link = item.mode == '40000' ? '/ref/tree' : '/ref/blob';
+              blob_or_tree_link = c.uri_for_action(action_for_link, c.req.captures, c.req.args.to_path(item.filename))
          -%]
-               <td class="file-name"><a href="[% blob_or_tree_link %]" class="[% item.type == 'blob' ? 'file' : 'folder' %]">[% item.file %]</a></td>
+               <td class="file-name"><a href="[% blob_or_tree_link %]" class="[% item.mode == '40000' ? 'folder' : 'file' %]">[% item.filename %]</a></td>
                <td class='action-list'>
        <a href="[% blob_or_tree_link %]">[% theact %]</a>
-         [% IF item.type == 'blob' %]
-       <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>
-       <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>
-       <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>
+         [% IF item.mode != '40000' %]
+       <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>
+       <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>
+       <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>
          [% END %]
-           <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>
+           <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>
                </td>
-          <td class="message">Loading commit info ...</td>
+          <td class="message"><span class='js-data'>[% c.req.args.to_path(item.filename) %]</span>Loading commit info ...</td>
        </tr>
                [% counter = counter + 1 %]
        [% END %]
 [% END %]
 
-
-
-
 <table class="listing" id="commit-tree">
 <thead>[% PROCESS tree_table_headfoot type = 'head' %]</thead>
 <tbody>
@@ -73,3 +54,6 @@ $(window).load(function() {
        [% PROCESS output_tree tree_type => tree_files   %]
 </tbody>
 </table>
+
+<span id='file_commit_info-uri' class='js-data'>[% c.uri_for_action('/fragment/ref/file_commit_info', [ Repository.name, Commit.sha1 ]) %]</span>
+<span id='commit-uri' class='js-data'>[% c.uri_for_action('/ref/commit', [Repository.name, 'HEAD']) %]</span>