The branch selector now sends you to the correct url
[catagits/Gitalist.git] / root / static / js / site.js
index 3c748fe..5af7d11 100755 (executable)
@@ -4,7 +4,7 @@ function findPos(obj) {
          do {
                  curleft += obj.offsetLeft;
                  curtop += obj.offsetTop;
-         } 
+         }
          while (obj = obj.offsetParent);
          return [curleft,curtop];
        }
@@ -45,8 +45,9 @@ function uriFor(action, sha1) {
 }
 
 function switchBranch() {
-    var branch = jQuery('#branch-list').val();
-    document.location.href = uriFor('current', branch);
+    var branch = jQuery('#branch-list').val(),
+        action = branch != '...' ? 'current' : 'heads';
+    document.location.href = uriFor(action, encodeURIComponent(branch).replace('/', '%2F'));
 }
 
 function compareDiffs(){
@@ -70,7 +71,9 @@ function _loadCommitInfo(cells) {
 }
 
 function loadCommitInfo() {
-  _loadCommitInfo( jQuery('#commit-tree .message').get() );
+  var cells = jQuery('#commit-tree .message').get();
+  if(cells.length > 0)
+    _loadCommitInfo( cells );
 }
 
 jQuery(function() {