##// END OF EJS Templates
implemented repo switcher list as dynamically loaded by xhr requestt....
marcink -
r1158:f63cc1cb beta
parent child Browse files
Show More
@@ -0,0 +1,15
1 ## -*- coding: utf-8 -*-
2 %for repo in c.repos_list:
3
4 %if repo['dbrepo']['private']:
5 <li>
6 <img src="${h.url("/images/icons/lock.png")}" alt="${_('Private repository')}" class="repo_switcher_type"/>
7 ${h.link_to(repo['name'].name,h.url('summary_home',repo_name=repo['name']),class_="%s" % repo['dbrepo']['repo_type'])}
8 </li>
9 %else:
10 <li>
11 <img src="${h.url("/images/icons/lock_open.png")}" alt="${_('Public repository')}" class="repo_switcher_type" />
12 ${h.link_to(repo['name'],h.url('summary_home',repo_name=repo['name']),class_="%s" % repo['dbrepo']['repo_type'])}
13 </li>
14 %endif
15 %endfor No newline at end of file
@@ -37,6 +37,7 def make_map(config):
37
37
38 #MAIN PAGE
38 #MAIN PAGE
39 routes_map.connect('home', '/', controller='home', action='index')
39 routes_map.connect('home', '/', controller='home', action='index')
40 routes_map.connect('repo_switcher', '/repos', controller='home', action='repo_switcher')
40 routes_map.connect('bugtracker', "http://bitbucket.org/marcinkuzminski/rhodecode/issues", _static=True)
41 routes_map.connect('bugtracker', "http://bitbucket.org/marcinkuzminski/rhodecode/issues", _static=True)
41 routes_map.connect('gpl_license', "http://www.gnu.org/licenses/gpl.html", _static=True)
42 routes_map.connect('gpl_license', "http://www.gnu.org/licenses/gpl.html", _static=True)
42 routes_map.connect('rhodecode_official', "http://rhodecode.org", _static=True)
43 routes_map.connect('rhodecode_official', "http://rhodecode.org", _static=True)
@@ -29,10 +29,12 import logging
29 from operator import itemgetter
29 from operator import itemgetter
30
30
31 from pylons import tmpl_context as c, request
31 from pylons import tmpl_context as c, request
32 from paste.httpexceptions import HTTPBadRequest
32
33
33 from rhodecode.lib.auth import LoginRequired
34 from rhodecode.lib.auth import LoginRequired
34 from rhodecode.lib.base import BaseController, render
35 from rhodecode.lib.base import BaseController, render
35
36
37
36 log = logging.getLogger(__name__)
38 log = logging.getLogger(__name__)
37
39
38 class HomeController(BaseController):
40 class HomeController(BaseController):
@@ -63,3 +65,11 class HomeController(BaseController):
63 reverse=False)
65 reverse=False)
64
66
65 return render('/index.html')
67 return render('/index.html')
68
69 def repo_switcher(self):
70 if request.is_xhr:
71 c.repos_list = sorted(c.cached_repo_list,
72 key=itemgetter('name_sort'), reverse=False)
73 return render('/repo_switcher_list.html')
74 else:
75 return HTTPBadRequest()
@@ -117,16 +117,28
117 </span>
117 </span>
118 <span>&darr;</span>
118 <span>&darr;</span>
119 </a>
119 </a>
120 <ul class="repo_switcher">
120 <ul id="repo_switcher_list" class="repo_switcher">
121 %for repo in c.cached_repo_list:
121 <li>
122
122 <a href="#">${_('loading...')}</a>
123 %if repo['dbrepo']['private']:
123 </li>
124 <li><img src="${h.url("/images/icons/lock.png")}" alt="${_('Private repository')}" class="repo_switcher_type"/>${h.link_to(repo['repo'].name,h.url('summary_home',repo_name=repo['repo'].name),class_="%s" % repo['dbrepo']['repo_type'])}</li>
125 %else:
126 <li><img src="${h.url("/images/icons/lock_open.png")}" alt="${_('Public repository')}" class="repo_switcher_type" />${h.link_to(repo['repo'].name,h.url('summary_home',repo_name=repo['repo'].name),class_="%s" % repo['dbrepo']['repo_type'])}</li>
127 %endif
128 %endfor
129 </ul>
124 </ul>
125 <script type="text/javascript">
126 YUE.on('repo_switcher','mouseover',function(){
127 var loaded = YUD.hasClass('repo_switcher','loaded');
128 if(!loaded){
129 YUD.addClass('repo_switcher','loaded');
130 YAHOO.util.Connect.asyncRequest('GET',"${h.url('repo_switcher')}",{
131 success:function(o){
132 YUD.get('repo_switcher_list').innerHTML = o.responseText;
133 },
134 failure:function(o){
135 YUD.removeClass('repo_switcher','loaded');
136 }
137 },null);
138 }
139 return false;
140 });
141 </script>
130 </li>
142 </li>
131
143
132 <li ${is_current('summary')}>
144 <li ${is_current('summary')}>
General Comments 0
You need to be logged in to leave comments. Login now