added dropdown nav to actions so can toggle between blob, raw, blame and history
Foxtons Web Design [Wed, 14 Apr 2010 13:46:45 +0000 (14:46 +0100)]
root/static/css/core.css
root/static/i/icons/Thumbs.db
root/wrapper.tt2

index d4220de..9d4a4eb 100755 (executable)
@@ -1,6 +1,6 @@
 #debug_holder{
        
-       display:none;
+       adisplay:none;
        
        clear:both;
        padding-top:30px;
@@ -180,7 +180,45 @@ a:hover{
        color:#DC143C;
 }
 
+/* sub actions dropdown changer in h1 */
+#actions_nav_link{
+       border:1px solid #666;
+       padding:1px 4px;
+       text-decoration:none;
+       outline:none;
+}
+#actions_nav_link span{
+       margin-right:5px;
+       padding-right:18px;
 
+       background:transparent url([% c.uri_for('/static/i/arrow_down_white.gif') %]) no-repeat right center;
+}
+#actions_nav_list{
+       display:none;
+       position:absolute;
+       padding:0 0 3px 0;
+       margin:0;
+       background-color:#333;
+       color:#fff;
+       font-size:1em;
+       border:1px solid #666;
+       border-top:none;
+}
+#actions_nav_list li{
+       list-style:none;
+       margin:0;
+       padding:2px 10px 2px 5px;
+}
+#actions_nav_list a{
+       color:#fff;
+       font-size:1.8em;
+}
+#actions_nav_list a:hover{
+       color:#EAF2F5;
+}
+.actions_nav_list_over{
+       display:block !important;
+}
 .button{
        display:block;
        float:left;
index cb41d4c..c804544 100644 (file)
Binary files a/root/static/i/icons/Thumbs.db and b/root/static/i/icons/Thumbs.db differ
index 545e7b3..4927bb8 100755 (executable)
                }
                document.location.href = "[% c.uri_for("/") %]" + repo + "/"+ sha1 + "/diff/" + sha2 + "/" + path;
        }
+       // handles hover sub menus in IE
+       startList = function() {
+               if (document.getElementById && document.getElementById("actions_nav_link")) {
+                       var navList = document.getElementById("actions_nav_list");
+                       var navLink = document.getElementById("actions_nav_link");
+                       // assign event handlers to each element
+                       navLink.onmouseover=function() {
+                               setNavClass(navList);
+                       }
+                       navList.onmouseover=function() {
+                               setNavClass(navList);
+                       }
+                       navList.onmouseout=function() {
+                               navList.className=navList.className.replace(" actions_nav_list_over", "");
+                       }
+                       navLink.onmouseout=function() {
+                               navList.className=navList.className.replace(" actions_nav_list_over", "");
+                       }
+               }
+               
+       }
+       function setNavClass(el){
+               var link_el = document.getElementById("actions_nav_link");
+               var offsetAry = findPos(link_el);
+               // set position of list
+               el.style.left = offsetAry[0]+"px";
+               el.style.top = offsetAry[1]+30 +"px";
+               el.className+=" actions_nav_list_over";
+       }
+       
+       function addLoadListener(fn){ 
+               if (typeof window.addEventListener != 'undefined') { 
+                       window.addEventListener('load', fn, false); 
+               }else if (typeof document.addEventListener != 'undefined'){ 
+                       document.addEventListener('load', fn, false); 
+               }else if (typeof window.attachEvent != 'undefined'){ 
+                       window.attachEvent('onload', fn); 
+               }else{ 
+                       var oldfn = window.onload; 
+                       if (typeof window.onload != 'function'){ 
+                               window.onload = fn; 
+                       }else{ 
+                               window.onload = function(){
+                                       oldfn();
+                                       fn();
+                               }; 
+                       }
+               }
+       }
+       function findPos(obj) {
+               var curleft = curtop = 0;
+               if (obj.offsetParent) {
+               do {
+                       curleft += obj.offsetLeft;
+                       curtop += obj.offsetTop;
+               } 
+               while (obj = obj.offsetParent);
+               return [curleft,curtop];
+               }
+       }
+       addLoadListener(startList);
        </script>
 </head>
 
                                [% END %]
                        [%- END %]
                        
+                       
                        [%- 
-                               c.action.name
-                                       .replace("_"," ")
-                                       .replace("log", " log")
-                                       .replace("fancy","")
-                                       .replace("index","Repositories") 
-                                       FILTER ucfirst 
+                               SET action_name = c.action.name
+                                                                       .replace("_"," ")
+                                                                       .replace("log", " log")
+                                                                       .replace("fancy","")
+                                                                       .replace("index","Repositories");
+                               action_name_ucfirst = action_name FILTER ucfirst;
+                               '<a href="#" id="actions_nav_link"><span>' _ action_name_ucfirst _ '</span></a>';
+                               
                        -%]
-                       
-       
-                       
+
                        </h1>
        
+                       [%- 
+                               SET actions_list = {
+                                               "blob"          => 1,
+                                               "raw"           => 1,
+                                               "blame"         => 1,
+                                               "history"       => 1,
+                                       };
+                                       
+                               IF actions_list.$action_name;
+                               '<ul id="actions_nav_list">';
+                                       FOREACH action IN actions_list;
+                                               action_output = action.key FILTER ucfirst;
+                                               NEXT IF action_output == action_name_ucfirst;   
+                                               action = action.key;
+                                               '<li><a href="/' _ c.req.path.replace(action_name, action) _ '">' _ action_output _ '</a></li>';
+                                       END;                    
+                               '</ul>';
+                               END;
+                       -%]
+               
        </div>
 </div>
 
-
+       
 <div id="content_holder">
        <div id="content" class="sub_holder">
                <div id="content_inner">
        [% USE Dumper %]
        <pre>
        [% Repository.path %]
-       [%# Dumper.dump(c.req.arguments.0) %]
+       [%# Dumper.dump(c.req.path) %]
        </pre>
        
        </div>