##// END OF EJS Templates
Added repo switcher, in base and long term caching for this.
marcink -
r107:5e2470eb default
parent child Browse files
Show More
@@ -45,10 +45,12 b' repos_name = Python-works'
45 ####################################
45 ####################################
46 beaker.cache.data_dir=/tmp/cache/data
46 beaker.cache.data_dir=/tmp/cache/data
47 beaker.cache.lock_dir=/tmp/cache/lock
47 beaker.cache.lock_dir=/tmp/cache/lock
48 beaker.cache.regions=short_term
48 beaker.cache.regions=short_term,long_term
49 beaker.cache.short_term.type=file
50 beaker.cache.short_term.expire=3600
49 beaker.cache.short_term.type=memory
51 beaker.cache.short_term.type=memory
50 beaker.cache.short_term.expire=60
52 beaker.cache.short_term.expire=60
51
53
52 ################################################################################
54 ################################################################################
53 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
55 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
54 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
56 ## Debug mode will enable the interactive debugging tool, allowing ANYONE to ##
@@ -45,9 +45,11 b' repos_name = Python-works'
45 ####################################
45 ####################################
46 beaker.cache.data_dir=/tmp/cache/data
46 beaker.cache.data_dir=/tmp/cache/data
47 beaker.cache.lock_dir=/tmp/cache/lock
47 beaker.cache.lock_dir=/tmp/cache/lock
48 beaker.cache.regions=short_term
48 beaker.cache.regions=short_term,long_term
49 beaker.cache.short_term.type=file
50 beaker.cache.short_term.expire=3600
49 beaker.cache.short_term.type=memory
51 beaker.cache.short_term.type=memory
50 beaker.cache.short_term.expire=3600
52 beaker.cache.short_term.expire=60
51
53
52 ################################################################################
54 ################################################################################
53 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
55 ## WARNING: *THE LINE BELOW MUST BE UNCOMMENTED ON A PRODUCTION ENVIRONMENT* ##
@@ -48,7 +48,7 b' def load_environment(global_conf, app_co'
48 imports=['from webhelpers.html import escape'])
48 imports=['from webhelpers.html import escape'])
49
49
50 #sets the c attribute access when don't existing attribute ar accessed
50 #sets the c attribute access when don't existing attribute ar accessed
51 config['pylons.strict_tmpl_context'] = False
51 config['pylons.strict_tmpl_context'] = True
52
52
53 #MULTIPLE DB configs
53 #MULTIPLE DB configs
54 # Setup the SQLAlchemy database engine
54 # Setup the SQLAlchemy database engine
@@ -27,6 +27,6 b' class SummaryController(BaseController):'
27 'repo_name':c.repo_name,
27 'repo_name':c.repo_name,
28 }
28 }
29 c.clone_repo_url = url(uri)
29 c.clone_repo_url = url(uri)
30 #c.repo_tags = c.repo_info.get_tags(limit=10)
30 c.repo_tags = []#c.repo_info.get_tags(limit=10)
31 #c.repo_branches = c.repo_info.get_branches(limit=10)
31 c.repo_branches = []#c.repo_info.get_branches(limit=10)
32 return render('/summary.html')
32 return render('/summary.html')
@@ -5,14 +5,25 b' Provides the BaseController class for su'
5 from pylons.controllers import WSGIController
5 from pylons.controllers import WSGIController
6 from pylons.templating import render_mako as render
6 from pylons.templating import render_mako as render
7 from pylons_app.model import meta
7 from pylons_app.model import meta
8 from beaker.cache import cache_region
9 from pylons import tmpl_context as c
10 from pylons_app.model.hg_model import HgModel
8
11
9 class BaseController(WSGIController):
12 class BaseController(WSGIController):
10
13 def _load_repos(self):
14
15 @cache_region('long_term', 'repo_list_2')
16 def _get_repos():
17 return [rep['name'] for rep in HgModel().get_repos()]
18
19 c.repo_list = _get_repos()
20
11 def __call__(self, environ, start_response):
21 def __call__(self, environ, start_response):
12 """Invoke the Controller"""
22 """Invoke the Controller"""
13 # WSGIController.__call__ dispatches to the Controller method
23 # WSGIController.__call__ dispatches to the Controller method
14 # the request is routed to. This routing information is
24 # the request is routed to. This routing information is
15 # available in environ['pylons.routes_dict']
25 # available in environ['pylons.routes_dict']
26 self._load_repos()
16 try:
27 try:
17 return WSGIController.__call__(self, environ, start_response)
28 return WSGIController.__call__(self, environ, start_response)
18 finally:
29 finally:
@@ -43,7 +43,7 b' div.page-header {'
43 margin: 10px 0 30px;
43 margin: 10px 0 30px;
44 font-size: 1.8em;
44 font-size: 1.8em;
45 font-weight: bold;
45 font-weight: bold;
46 font-family: osaka,'MS P Gothic', Georgia, serif;
46 font-family: sans-serif;
47 letter-spacing: 1px;
47 letter-spacing: 1px;
48 color: #DDD;
48 color: #DDD;
49 }
49 }
@@ -91,18 +91,21 b' div.page-header {'
91 ul.page-nav li {
91 ul.page-nav li {
92 margin: 0 2px 0 0;
92 margin: 0 2px 0 0;
93 float: left;
93 float: left;
94 width: 80px;
95 height: 24px;
94 height: 24px;
96 font-size: 1.1em;
95 font-size: 1.1em;
97 line-height: 24px;
96 line-height: 24px;
98 text-align: center;
97 text-align: center;
99 }
98 }
100 ul.page-nav li.current {
99 ul.page-nav li.current {
101 background: #FFF;
100 background: #FFF;
101 padding-right:5px;
102 padding-left:5px;
102 }
103 }
103 ul.page-nav li a {
104 ul.page-nav li a {
104 height: 24px;
105 height: 24px;
105 color: #666;
106 color: #666;
107 padding-right:5px;
108 padding-left:5px;
106 background: #DDD;
109 background: #DDD;
107 display: block;
110 display: block;
108 text-decoration: none;
111 text-decoration: none;
@@ -51,7 +51,36 b''
51
51
52 <%def name="menu(current)">
52 <%def name="menu(current)">
53 <ul class="page-nav">
53 <ul class="page-nav">
54
54 <script>
55 YAHOO.util.Event.onDOMReady(function(){
56 YAHOO.util.Event.addListener('repo_switcher','click',function(){
57 if(YAHOO.util.Dom.hasClass('repo_switcher','selected')){
58 YAHOO.util.Dom.setStyle('switch_repos','display','none');
59 YAHOO.util.Dom.removeClass('repo_switcher','selected');
60 }
61 else{
62 YAHOO.util.Dom.setStyle('switch_repos','display','');
63 YAHOO.util.Dom.addClass('repo_switcher','selected');
64 }
65 });
66 YAHOO.util.Event.addListener('repos_list','change',function(e){
67 var wa = YAHOO.util.Dom.get('repos_list').value;
68
69 var url = "${h.url('summary_home',repo_name='__REPLACE__')}".replace('__REPLACE__',wa);
70 window.location = url;
71 })
72 });
73 </script>
74 <li>
75 <a id="repo_switcher" title="${_('Switch repository')}" href="#">&darr;</a>
76 <div id="switch_repos" style="display:none;position: absolute;width: 150px;height: 25px;background-color: #DDDDDD">
77 <select id="repos_list">
78 %for repo in c.repo_list:
79 <option value="${repo}">${repo}</option>
80 %endfor
81 </select>
82 </div>
83 </li>
55 <li
84 <li
56 %if current=='summary':
85 %if current=='summary':
57 class='current'
86 class='current'
General Comments 0
You need to be logged in to leave comments. Login now