##// END OF EJS Templates
Implemented fancier top menu for logged and anonymous users...
marcink -
r784:30d3161c beta
parent child Browse files
Show More
@@ -21,10 +21,12 b' class BaseController(WSGIController):'
21 21 c.cached_repo_list = ScmModel().get_repos()
22 22 c.backends = BACKENDS.keys()
23 23
24 self.sa = meta.Session()
25 scm_model = ScmModel(self.sa)
26 #c.unread_journal = scm_model.get_unread_journal()
27
24 28 if c.repo_name:
25 scm_model = ScmModel()
26 29 cached_repo = scm_model.get(c.repo_name)
27
28 30 if cached_repo:
29 31 c.repository_tags = cached_repo.tags
30 32 c.repository_branches = cached_repo.branches
@@ -36,7 +38,6 b' class BaseController(WSGIController):'
36 38 c.repository_followers = 0
37 39 c.repository_forks = 0
38 40
39 self.sa = meta.Session()
40 41
41 42 def __call__(self, environ, start_response):
42 43 """Invoke the Controller"""
@@ -110,7 +110,7 b' def query_callable(manager):'
110 110
111 111 def get_cache_region(name, region):
112 112 if region not in beaker.cache.cache_regions:
113 raise BeakerException('Cache region not configured: %s'
113 raise BeakerException('Cache region `%s` not configured '
114 114 'Check if proper cache settings are in the .ini files' % region)
115 115 kw = beaker.cache.cache_regions[region]
116 116 return beaker.cache.Cache._get_cache(name, kw)
@@ -46,7 +46,7 b' from rhodecode.model import BaseModel'
46 46 from rhodecode.model.user import UserModel
47 47
48 48 from rhodecode.model.db import Repository, RhodeCodeUi, CacheInvalidation, \
49 UserFollowing
49 UserFollowing, UserLog
50 50 from rhodecode.model.caching_query import FromCache
51 51
52 52 from sqlalchemy.orm import joinedload
@@ -333,6 +333,11 b' class ScmModel(BaseModel):'
333 333 return self.sa.query(Repository)\
334 334 .filter(Repository.fork_id == repo_id).count()
335 335
336
337 def get_unread_journal(self):
338 return self.sa.query(UserLog).count()
339
340
336 341 def _should_invalidate(self, repo_name):
337 342 """
338 343 Looks up database for invalidation signals for this repo_name
@@ -190,18 +190,32 b' margin:0;'
190 190 padding:0 30px;
191 191 }
192 192
193
194 #header ul#logged-user{
195 margin-bottom:5px !important;
196 -webkit-border-radius: 0px 0px 8px 8px;
197 -khtml-border-radius: 0px 0px 8px 8px;
198 -moz-border-radius: 0px 0px 8px 8px;
199 border-radius: 0px 0px 8px 8px;
200 height:37px;
201 background:url("../images/header_inner.png") repeat-x scroll 0 0 #003367
202 }
203
193 204 #header ul#logged-user li {
194 205 list-style:none;
195 206 float:left;
196 border-left:1px solid #bbb;
197 border-right:1px solid #a5a5a5;
198 margin:-2px 0 0;
199 padding:10px 12px;
207 margin:8px 0 0;
208 padding:4px 12px;
209 border-left: 1px solid #316293;
200 210 }
201 211
202 212 #header ul#logged-user li.first {
203 213 border-left:none;
204 margin:-6px;
214 margin:4px;
215 }
216
217 #header ul#logged-user li.first div.gravatar {
218 margin-top:-2px;
205 219 }
206 220
207 221 #header ul#logged-user li.first div.account {
@@ -214,13 +228,12 b' border-right:none;'
214 228 }
215 229
216 230 #header ul#logged-user li a {
217 color:#4e4e4e;
231 color:#fff;
218 232 font-weight:700;
219 233 text-decoration:none;
220 234 }
221 235
222 236 #header ul#logged-user li a:hover {
223 color:#376ea6;
224 237 text-decoration:underline;
225 238 }
226 239
@@ -229,7 +242,7 b' color:#fff;'
229 242 }
230 243
231 244 #header ul#logged-user li.highlight a:hover {
232 color:#376ea6;
245 color:#FFF;
233 246 }
234 247
235 248 #header #header-inner {
@@ -16,26 +16,34 b''
16 16 <div id="header">
17 17 <!-- user -->
18 18 <ul id="logged-user">
19 %if c.rhodecode_user.username == 'default':
20 19 <li class="first">
20 <div class="gravatar">
21 <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,20)}" />
22 </div>
21 23 <div class="account">
22 ## ${h.link_to('%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname),h.url('#'))}<br/>
23 ## ${h.link_to(c.rhodecode_user.username,h.url('#'))}
24 %if c.rhodecode_user.username == 'default':
25 ##${h.link_to('%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname),h.url('register'))}<br/>
26 ${h.link_to('anonymous',h.url('register'))}
27 %else:
28 ##${h.link_to('%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname),h.url('admin_settings_my_account'))}<br/>
29 ${h.link_to(c.rhodecode_user.username,h.url('admin_settings_my_account'))}
30 %endif
24 31 </div>
25 32 </li>
33 <li>
34 <a href="${h.url('home')}">${_('Home')}</a>
35 </li>
36 <li>
37 <a href="${h.url('journal')}">${_('Journal')}</a>
38 ##(${c.unread_journal})</a>
39 </li>
40 %if c.rhodecode_user.username == 'default':
26 41 <li class="last highlight">${h.link_to(u'Login',h.url('login_home'))}</li>
27 42 %else:
28 <li class="first">
29 <div class="gravatar">
30 <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,24)}" />
31 </div>
32 <div class="account">
33 ${h.link_to('%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname),h.url('admin_settings_my_account'))}<br/>
34 ${h.link_to(c.rhodecode_user.username,h.url('admin_settings_my_account'))}
35 </div>
36 </li>
37 <li class="last highlight">${h.link_to(u'Logout',h.url('logout_home'))}</li>
43 <li class="last highlight">${h.link_to(u'Log Out',h.url('logout_home'))}</li>
38 44 %endif
45
46
39 47 </ul>
40 48 <!-- end user -->
41 49 <div id="header-inner" class="title top-left-rounded-corner top-right-rounded-corner">
General Comments 0
You need to be logged in to leave comments. Login now