diff options
author | Mads Kiilerich <madski@unity3d.com> | 2013-04-03 17:20:32 +0200 |
---|---|---|
committer | Mads Kiilerich <madski@unity3d.com> | 2013-04-03 17:20:32 +0200 |
commit | 2ac5112347202842644fc1ff92f0891c8284a71d (patch) | |
tree | 7503693f7ed8b7b6c146c35d0c2f5a6ead665ce8 | |
parent | 22f713d07f09d47b8dec72d9f0f848e76f2baa49 (diff) |
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.
--HG--
branch : beta
extra : source : 5e0cfb2234ca2357609f04d7073dbba53b4d9642
-rw-r--r-- | rhodecode/templates/summary/summary.html | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/rhodecode/templates/summary/summary.html b/rhodecode/templates/summary/summary.html index 4faba867..36e160c5 100644 --- a/rhodecode/templates/summary/summary.html +++ b/rhodecode/templates/summary/summary.html @@ -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()"> |