# HG changeset patch # User Marcin Kuzminski # Date 1319842629 -7200 # Node ID 0069657aaf42cdb292b84c033ff21789d6198777 # Parent e886f91fcb7184b6c095f36a8cda7f80ce2fa49b lazy load of branches and tags menu - to reduce load on repositories with large amount of branches and tags. - reduce load times of pages significantly on large repos diff -r e886f91fcb71 -r 0069657aaf42 rhodecode/config/routing.py --- a/rhodecode/config/routing.py Fri Oct 28 02:40:22 2011 +0200 +++ b/rhodecode/config/routing.py Sat Oct 29 00:57:09 2011 +0200 @@ -62,6 +62,8 @@ rmap.connect('home', '/', controller='home', action='index') rmap.connect('repo_switcher', '/repos', controller='home', action='repo_switcher') + rmap.connect('branch_tag_switcher', '/branches-tags/{repo_name:.*}', + controller='home',action='branch_tag_switcher') rmap.connect('bugtracker', "http://bitbucket.org/marcinkuzminski/rhodecode/issues", _static=True) diff -r e886f91fcb71 -r 0069657aaf42 rhodecode/controllers/home.py --- a/rhodecode/controllers/home.py Fri Oct 28 02:40:22 2011 +0200 +++ b/rhodecode/controllers/home.py Sat Oct 29 00:57:09 2011 +0200 @@ -58,3 +58,12 @@ return render('/repo_switcher_list.html') else: return HTTPBadRequest() + + def branch_tag_switcher(self, repo_name): + c.rhodecode_db_repo = Repository.get_by_repo_name(c.repo_name) + c.rhodecode_repo = c.rhodecode_db_repo.scm_instance + return render('/switch_to_list.html') + if request.is_xhr: + return render('/switch_to_list.html') + else: + return HTTPBadRequest() diff -r e886f91fcb71 -r 0069657aaf42 rhodecode/templates/base/base.html --- a/rhodecode/templates/base/base.html Fri Oct 28 02:40:22 2011 +0200 +++ b/rhodecode/templates/base/base.html Sat Oct 29 00:57:09 2011 +0200 @@ -149,60 +149,6 @@ ${_('loading...')} -
  • @@ -231,38 +177,15 @@
  • - + ${_('Switch to')} ${_('Switch to')} - +
  • @@ -329,8 +252,73 @@ ${c.repository_forks}
  • - + %else: ##ROOT MENU - %endif + %endif diff -r e886f91fcb71 -r 0069657aaf42 rhodecode/templates/switch_to_list.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rhodecode/templates/switch_to_list.html Sat Oct 29 00:57:09 2011 +0200 @@ -0,0 +1,25 @@ +## -*- coding: utf-8 -*- +
  • + ${h.link_to('%s (%s)' % (_('branches'),len(c.rhodecode_repo.branches.values()),),h.url('branches_home',repo_name=c.repo_name),class_='branches childs')} + +
  • +
  • + ${h.link_to('%s (%s)' % (_('tags'),len(c.rhodecode_repo.tags.values()),),h.url('tags_home',repo_name=c.repo_name),class_='tags childs')} + +
  • \ No newline at end of file