X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=root%2Fwrapper.tt2;h=7006bbbfd247f1d15508fa7f14d683f18ab2638a;hb=d808f958c0b825070c1c76d256c6beee9ffafe6a;hp=545e7b3246305e5368beac531f4ebb54111b6e92;hpb=03686cdc7927a63853a4399c04e8c9cd1fa68014;p=catagits%2FGitalist.git diff --git a/root/wrapper.tt2 b/root/wrapper.tt2 index 545e7b3..7006bbb 100755 --- a/root/wrapper.tt2 +++ b/root/wrapper.tt2 @@ -44,8 +44,69 @@ } } } - document.location.href = "[% c.uri_for("/") %]" + repo + "/"+ sha1 + "/diff/" + sha2 + "/" + path; + document.location.href = "[% c.uri_for("/") %]" + repo + "/"+ sha2 + "/diff/" + sha1 + "/" + 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); @@ -57,13 +118,16 @@ @@ -82,10 +146,8 @@
  • - [%# FIXME: convert to c.uri_for_action #%] - Branches - [% FOREACH branch_head IN Repository.heads %] @@ -114,23 +176,48 @@ [% END %] [%- END %] + [%- - c.action.name - .replace("_"," ") - .replace("log", " log") - .replace("fancy","") - .replace("index","Repositories") - FILTER ucfirst + SET actions_list = { + "blob" => 1, + "raw" => 1, + "blame" => 1, + "history" => 1, + }; + + SET action_name = c.action.name + .replace("_"," ") + .replace("log", " log") + .replace("fancy","") + .replace("index","Repositories"); + action_name_ucfirst = action_name FILTER ucfirst; + IF actions_list.$action_name; + '' _ action_name_ucfirst _ ''; + ELSE; + action_name_ucfirst; + END; + -%] - - - + + [%- + IF actions_list.$action_name; + ''; + END; + -%] + - +
    @@ -168,7 +255,7 @@ [% USE Dumper %]
     	[% Repository.path %]
    -	[%# Dumper.dump(c.req.arguments.0) %]
    +	[%# Dumper.dump(c.req.path) %]