##// 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 c.cached_repo_list = ScmModel().get_repos()
21 c.cached_repo_list = ScmModel().get_repos()
22 c.backends = BACKENDS.keys()
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 if c.repo_name:
28 if c.repo_name:
25 scm_model = ScmModel()
26 cached_repo = scm_model.get(c.repo_name)
29 cached_repo = scm_model.get(c.repo_name)
27
28 if cached_repo:
30 if cached_repo:
29 c.repository_tags = cached_repo.tags
31 c.repository_tags = cached_repo.tags
30 c.repository_branches = cached_repo.branches
32 c.repository_branches = cached_repo.branches
@@ -36,7 +38,6 b' class BaseController(WSGIController):'
36 c.repository_followers = 0
38 c.repository_followers = 0
37 c.repository_forks = 0
39 c.repository_forks = 0
38
40
39 self.sa = meta.Session()
40
41
41 def __call__(self, environ, start_response):
42 def __call__(self, environ, start_response):
42 """Invoke the Controller"""
43 """Invoke the Controller"""
@@ -110,7 +110,7 b' def query_callable(manager):'
110
110
111 def get_cache_region(name, region):
111 def get_cache_region(name, region):
112 if region not in beaker.cache.cache_regions:
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 'Check if proper cache settings are in the .ini files' % region)
114 'Check if proper cache settings are in the .ini files' % region)
115 kw = beaker.cache.cache_regions[region]
115 kw = beaker.cache.cache_regions[region]
116 return beaker.cache.Cache._get_cache(name, kw)
116 return beaker.cache.Cache._get_cache(name, kw)
@@ -46,7 +46,7 b' from rhodecode.model import BaseModel'
46 from rhodecode.model.user import UserModel
46 from rhodecode.model.user import UserModel
47
47
48 from rhodecode.model.db import Repository, RhodeCodeUi, CacheInvalidation, \
48 from rhodecode.model.db import Repository, RhodeCodeUi, CacheInvalidation, \
49 UserFollowing
49 UserFollowing, UserLog
50 from rhodecode.model.caching_query import FromCache
50 from rhodecode.model.caching_query import FromCache
51
51
52 from sqlalchemy.orm import joinedload
52 from sqlalchemy.orm import joinedload
@@ -333,6 +333,11 b' class ScmModel(BaseModel):'
333 return self.sa.query(Repository)\
333 return self.sa.query(Repository)\
334 .filter(Repository.fork_id == repo_id).count()
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 def _should_invalidate(self, repo_name):
341 def _should_invalidate(self, repo_name):
337 """
342 """
338 Looks up database for invalidation signals for this repo_name
343 Looks up database for invalidation signals for this repo_name
@@ -190,18 +190,32 b' margin:0;'
190 padding:0 30px;
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 #header ul#logged-user li {
204 #header ul#logged-user li {
194 list-style:none;
205 list-style:none;
195 float:left;
206 float:left;
196 border-left:1px solid #bbb;
207 margin:8px 0 0;
197 border-right:1px solid #a5a5a5;
208 padding:4px 12px;
198 margin:-2px 0 0;
209 border-left: 1px solid #316293;
199 padding:10px 12px;
200 }
210 }
201
211
202 #header ul#logged-user li.first {
212 #header ul#logged-user li.first {
203 border-left:none;
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 #header ul#logged-user li.first div.account {
221 #header ul#logged-user li.first div.account {
@@ -214,13 +228,12 b' border-right:none;'
214 }
228 }
215
229
216 #header ul#logged-user li a {
230 #header ul#logged-user li a {
217 color:#4e4e4e;
231 color:#fff;
218 font-weight:700;
232 font-weight:700;
219 text-decoration:none;
233 text-decoration:none;
220 }
234 }
221
235
222 #header ul#logged-user li a:hover {
236 #header ul#logged-user li a:hover {
223 color:#376ea6;
224 text-decoration:underline;
237 text-decoration:underline;
225 }
238 }
226
239
@@ -229,7 +242,7 b' color:#fff;'
229 }
242 }
230
243
231 #header ul#logged-user li.highlight a:hover {
244 #header ul#logged-user li.highlight a:hover {
232 color:#376ea6;
245 color:#FFF;
233 }
246 }
234
247
235 #header #header-inner {
248 #header #header-inner {
@@ -16,26 +16,34 b''
16 <div id="header">
16 <div id="header">
17 <!-- user -->
17 <!-- user -->
18 <ul id="logged-user">
18 <ul id="logged-user">
19 %if c.rhodecode_user.username == 'default':
20 <li class="first">
19 <li class="first">
20 <div class="gravatar">
21 <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,20)}" />
22 </div>
21 <div class="account">
23 <div class="account">
22 ## ${h.link_to('%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname),h.url('#'))}<br/>
24 %if c.rhodecode_user.username == 'default':
23 ## ${h.link_to(c.rhodecode_user.username,h.url('#'))}
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 </div>
31 </div>
25 </li>
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 <li class="last highlight">${h.link_to(u'Login',h.url('login_home'))}</li>
41 <li class="last highlight">${h.link_to(u'Login',h.url('login_home'))}</li>
27 %else:
42 %else:
28 <li class="first">
43 <li class="last highlight">${h.link_to(u'Log Out',h.url('logout_home'))}</li>
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>
38 %endif
44 %endif
45
46
39 </ul>
47 </ul>
40 <!-- end user -->
48 <!-- end user -->
41 <div id="header-inner" class="title top-left-rounded-corner top-right-rounded-corner">
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