diff --git a/rhodecode/config/routing.py b/rhodecode/config/routing.py --- a/rhodecode/config/routing.py +++ b/rhodecode/config/routing.py @@ -37,6 +37,7 @@ def make_map(config): #MAIN PAGE routes_map.connect('home', '/', controller='home', action='index') + routes_map.connect('repo_switcher', '/repos', controller='home', action='repo_switcher') routes_map.connect('bugtracker', "http://bitbucket.org/marcinkuzminski/rhodecode/issues", _static=True) routes_map.connect('gpl_license', "http://www.gnu.org/licenses/gpl.html", _static=True) routes_map.connect('rhodecode_official', "http://rhodecode.org", _static=True) diff --git a/rhodecode/controllers/home.py b/rhodecode/controllers/home.py --- a/rhodecode/controllers/home.py +++ b/rhodecode/controllers/home.py @@ -29,10 +29,12 @@ import logging from operator import itemgetter from pylons import tmpl_context as c, request +from paste.httpexceptions import HTTPBadRequest from rhodecode.lib.auth import LoginRequired from rhodecode.lib.base import BaseController, render + log = logging.getLogger(__name__) class HomeController(BaseController): @@ -63,3 +65,11 @@ class HomeController(BaseController): reverse=False) return render('/index.html') + + def repo_switcher(self): + if request.is_xhr: + c.repos_list = sorted(c.cached_repo_list, + key=itemgetter('name_sort'), reverse=False) + return render('/repo_switcher_list.html') + else: + return HTTPBadRequest() diff --git a/rhodecode/templates/base/base.html b/rhodecode/templates/base/base.html --- a/rhodecode/templates/base/base.html +++ b/rhodecode/templates/base/base.html @@ -117,16 +117,28 @@ - + +
  • diff --git a/rhodecode/templates/repo_switcher_list.html b/rhodecode/templates/repo_switcher_list.html new file mode 100644 --- /dev/null +++ b/rhodecode/templates/repo_switcher_list.html @@ -0,0 +1,15 @@ +## -*- coding: utf-8 -*- +%for repo in c.repos_list: + + %if repo['dbrepo']['private']: +
  • + ${_('Private repository')} + ${h.link_to(repo['name'].name,h.url('summary_home',repo_name=repo['name']),class_="%s" % repo['dbrepo']['repo_type'])} +
  • + %else: +
  • + ${_('Public repository')} + ${h.link_to(repo['name'],h.url('summary_home',repo_name=repo['name']),class_="%s" % repo['dbrepo']['repo_type'])} +
  • + %endif +%endfor \ No newline at end of file