changeset 3655:c78de39f30fc beta

summary: redirect from repo URLs with #branchname to changelog with this branch This implements partial support for the Mercurial syntax for specifying revisions so https://secure.rhodecode.org/rhodecode/#beta works both for pulling with Mercurial and browsing. This uses javascript, and has a bit of extra support for onhashchange in HTML5 browsers.
author Mads Kiilerich <madski@unity3d.com>
date Wed, 03 Apr 2013 17:20:32 +0200
parents ec6354949623
children 79abd21d51c4
files rhodecode/templates/summary/summary.html
diffstat 1 files changed, 15 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/templates/summary/summary.html	Wed Apr 03 17:19:47 2013 +0200
+++ b/rhodecode/templates/summary/summary.html	Wed Apr 03 17:20:32 2013 +0200
@@ -15,6 +15,21 @@
 <%def name="head_extra()">
 <link href="${h.url('atom_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('%s ATOM feed') % c.repo_name}" type="application/atom+xml" />
 <link href="${h.url('rss_feed_home',repo_name=c.dbrepo.repo_name,api_key=c.rhodecode_user.api_key)}" rel="alternate" title="${_('%s RSS feed') % c.repo_name}" type="application/rss+xml" />
+
+<script>
+redirect_hash_branch = function(){
+    var branch = window.location.hash.replace(/^#(.*)/, '$1');
+	if (branch){
+	    window.location = "${h.url('changelog_home',repo_name=c.repo_name,branch='__BRANCH__')}"
+	    	.replace('__BRANCH__',branch);
+	}
+}
+redirect_hash_branch();
+window.onhashchange = function() {
+	redirect_hash_branch();
+};
+</script>
+
 </%def>
 
 <%def name="main()">