added file and folder icons to tree view and updated favicon
Foxtons Web Design [Wed, 21 Apr 2010 13:44:46 +0000 (14:44 +0100)]
root/favicon.ico [changed mode: 0644->0755]
root/fragment/ref/tree.tt2
root/static/css/core.css
root/static/favicon.ico [new file with mode: 0755]
root/static/i/favicon.gif [new file with mode: 0755]
root/static/i/favicon.png [new file with mode: 0755]
root/static/i/icons/file.png [new file with mode: 0755]
root/static/i/icons/folder.png [new file with mode: 0755]
root/wrapper.tt2

old mode 100644 (file)
new mode 100755 (executable)
index de637c0..fea2fec
Binary files a/root/favicon.ico and b/root/favicon.ico differ
index 68cfa12..b043808 100755 (executable)
@@ -2,34 +2,59 @@
 [% SET cell = type == 'head' ? 'th' : 'td' %]
   <tr>
    <[% cell %]>Mode</[% cell %]>
-   <[% cell %]>File</[% cell %]>
+   <[% cell %]>Folder / File</[% cell %]>
    <[% cell %]>Actions</[% cell %]>
   </tr>
 [% END %]
-<table class="listing">
- <thead>[% PROCESS tree_table_headfoot type = 'head' %]</thead>
- <tbody>
-  [% FOREACH item IN tree_list %]
- <tr [% "class='invert'" IF loop.count % 2 %]>
-   <td class='file-mode'>[% item.modestr %]</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))
-   -%]
-   <td class='file-name'>
-    <a href="[% blob_or_tree_link %]">[% item.file %]</a>
-   </td>
-   <td class='action-list'>
+
+
+
+[%-
+       SET counter         = 1;
+       
+       # sort files and folders
+       SET tree_files          = [];
+       SET tree_folders        = [];
+       FOREACH item IN tree_list;
+               IF item.type == "blob";
+                       tree_files.push(item);
+               ELSE;
+                       tree_folders.push(item);
+               END;
+       END;
+%]
+
+[% BLOCK output_tree %]
+       [% FOREACH item IN tree_type.sort('file') %]
+       <tr [% "class='invert'" IF counter % 2 %]>
+               <td class='file-mode'>[% item.modestr %]</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))
+         -%]
+               <td class="file-name"><a href="[% blob_or_tree_link %]" class="[% item.type == 'blob' ? 'file' : 'folder' %]">[% item.file %]</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>
          [% 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>
-   </td>
-  </tr>
-  [% END %]
- </tbody>
+           <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>
+               </td>
+       </tr>
+               [% counter = counter + 1 %]
+       [% END %]
+[% END %]
+
+
+
+
+<table class="listing">
+<thead>[% PROCESS tree_table_headfoot type = 'head' %]</thead>
+<tbody>
+       [% INCLUDE output_tree tree_type => tree_folders %]
+       [% PROCESS output_tree tree_type => tree_files   %]
+</tbody>
 </table>
index c6d2967..8abfa26 100755 (executable)
@@ -272,6 +272,14 @@ a.raw{
        padding-top:2px;
        float:left;
 }
+a.file{
+       padding-left:25px;
+       background:transparent url([% c.uri_for('/static/i/icons/file.png') %]) no-repeat;
+}
+a.folder{
+       padding-left:25px;
+       background:transparent url([% c.uri_for('/static/i/icons/folder.png') %]) no-repeat;
+}
 .msg{
        padding:5px 10px 5px 35px;
        background:#f0f0f0 url([% c.uri_for('/static/i/icons/attention.png') %]) no-repeat 10px center;
diff --git a/root/static/favicon.ico b/root/static/favicon.ico
new file mode 100755 (executable)
index 0000000..fea2fec
Binary files /dev/null and b/root/static/favicon.ico differ
diff --git a/root/static/i/favicon.gif b/root/static/i/favicon.gif
new file mode 100755 (executable)
index 0000000..29319a5
Binary files /dev/null and b/root/static/i/favicon.gif differ
diff --git a/root/static/i/favicon.png b/root/static/i/favicon.png
new file mode 100755 (executable)
index 0000000..9c14c24
Binary files /dev/null and b/root/static/i/favicon.png differ
diff --git a/root/static/i/icons/file.png b/root/static/i/icons/file.png
new file mode 100755 (executable)
index 0000000..1d0e6e0
Binary files /dev/null and b/root/static/i/icons/file.png differ
diff --git a/root/static/i/icons/folder.png b/root/static/i/icons/folder.png
new file mode 100755 (executable)
index 0000000..2016319
Binary files /dev/null and b/root/static/i/icons/folder.png differ
index 7006bbb..4611441 100755 (executable)
@@ -20,7 +20,7 @@
   [% INCLUDE '_header_feeds.tt2' %]
    
        <link rel="stylesheet" type="text/css" href="[% c.uri_for('/core.css') %]" />
-       <link rel="shortcut icon" href="[% c.uri_for('/static/git-favicon.png') %]" type="image/png" />
+       <link rel="shortcut icon" href="[% c.uri_for('/static/favicon.ico') %]" type="image/png" />
        <script type="text/javascript">
        // FIXME: this should be in an external js file once c.uri_for works in js files
        function compareDiffs(repo, path){
                        
                        
                        [%- 
+                               
+                               #FIXME on a history view of a folder, don't show extra actions in dropdown
+                               SET on_file_page = 1;
+                               
                                SET actions_list = {
                                                "blob"          => 1,
                                                "raw"           => 1,
                                                                        .replace("fancy","")
                                                                        .replace("index","Repositories");
                                action_name_ucfirst = action_name FILTER ucfirst;
-                               IF actions_list.$action_name;
+                               IF actions_list.$action_name && on_file_page;
                                        '<a href="#" id="actions_nav_link"><span>' _ action_name_ucfirst _ '</span></a>';
                                ELSE;
                                        action_name_ucfirst;
        [% USE Dumper %]
        <pre>
        [% Repository.path %]
-       [%# Dumper.dump(c.req.path) %]
+       [%# Dumper.dump(Commit) %]
        </pre>
        
        </div>