Changeset - 30d3161c6683
[Not reviewed]
beta
0 5 0
Marcin Kuzminski - 15 years ago 2010-11-28 05:26:26
marcin@python-works.com
Implemented fancier top menu for logged and anonymous users
little error fix for cached query
5 files changed with 53 insertions and 26 deletions:
0 comments (0 inline, 0 general)
rhodecode/lib/base.py
Show inline comments
 
@@ -21,10 +21,12 @@ class BaseController(WSGIController):
 
        c.cached_repo_list = ScmModel().get_repos()
 
        c.backends = BACKENDS.keys()
 

	
 
        self.sa = meta.Session()
 
        scm_model = ScmModel(self.sa)
 
        #c.unread_journal = scm_model.get_unread_journal()
 

	
 
        if c.repo_name:
 
            scm_model = ScmModel()
 
            cached_repo = scm_model.get(c.repo_name)
 

	
 
            if cached_repo:
 
                c.repository_tags = cached_repo.tags
 
                c.repository_branches = cached_repo.branches
 
@@ -36,7 +38,6 @@ class BaseController(WSGIController):
 
                c.repository_followers = 0
 
                c.repository_forks = 0
 

	
 
        self.sa = meta.Session()
 

	
 
    def __call__(self, environ, start_response):
 
        """Invoke the Controller"""
rhodecode/model/caching_query.py
Show inline comments
 
@@ -110,7 +110,7 @@ def query_callable(manager):
 

	
 
def get_cache_region(name, region):
 
    if region not in beaker.cache.cache_regions:
 
        raise BeakerException('Cache region not configured: %s'
 
        raise BeakerException('Cache region `%s` not configured '
 
            'Check if proper cache settings are in the .ini files' % region)
 
    kw = beaker.cache.cache_regions[region]
 
    return beaker.cache.Cache._get_cache(name, kw)
rhodecode/model/scm.py
Show inline comments
 
@@ -46,7 +46,7 @@ from rhodecode.model import BaseModel
 
from rhodecode.model.user import UserModel
 

	
 
from rhodecode.model.db import Repository, RhodeCodeUi, CacheInvalidation, \
 
    UserFollowing
 
    UserFollowing, UserLog
 
from rhodecode.model.caching_query import FromCache
 

	
 
from sqlalchemy.orm import joinedload
 
@@ -333,6 +333,11 @@ class ScmModel(BaseModel):
 
        return self.sa.query(Repository)\
 
                .filter(Repository.fork_id == repo_id).count()
 

	
 

	
 
    def get_unread_journal(self):
 
        return self.sa.query(UserLog).count()
 

	
 

	
 
    def _should_invalidate(self, repo_name):
 
        """
 
        Looks up database for invalidation signals for this repo_name
rhodecode/public/css/style.css
Show inline comments
 
@@ -190,18 +190,32 @@ margin:0;
 
padding:0 30px;
 
}
 
 
 
#header ul#logged-user{
 
margin-bottom:5px !important;
 
-webkit-border-radius: 0px 0px 8px 8px;
 
-khtml-border-radius: 0px 0px 8px 8px; 
 
-moz-border-radius: 0px 0px 8px 8px;
 
border-radius: 0px 0px 8px 8px;
 
height:37px;
 
background:url("../images/header_inner.png") repeat-x scroll 0 0 #003367
 
}
 
 
#header ul#logged-user li {
 
list-style:none;
 
float:left;
 
border-left:1px solid #bbb;
 
border-right:1px solid #a5a5a5;
 
margin:-2px 0 0;
 
padding:10px 12px;
 
margin:8px 0 0;
 
padding:4px 12px;
 
border-left: 1px solid #316293;
 
}
 
 
#header ul#logged-user li.first {
 
border-left:none;
 
margin:-6px;
 
margin:4px;
 
}
 
 
#header ul#logged-user li.first div.gravatar {
 
margin-top:-2px;
 
}
 
 
#header ul#logged-user li.first div.account {
 
@@ -214,13 +228,12 @@ border-right:none;
 
}
 
 
#header ul#logged-user li a {
 
color:#4e4e4e;
 
color:#fff;
 
font-weight:700;
 
text-decoration:none;
 
}
 
 
#header ul#logged-user li a:hover {
 
color:#376ea6;
 
text-decoration:underline;
 
}
 
 
@@ -229,7 +242,7 @@ color:#fff;
 
}
 
 
#header ul#logged-user li.highlight a:hover {
 
color:#376ea6;
 
color:#FFF;
 
}
 
 
#header #header-inner {
rhodecode/templates/base/base.html
Show inline comments
 
@@ -16,26 +16,34 @@
 
    <div id="header">
 
        <!-- user -->
 
        <ul id="logged-user">
 
            %if c.rhodecode_user.username == 'default':
 
	            <li class="first">
 
	                <div class="gravatar">
 
	                    <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,20)}" />
 
	                </div>
 
	                <div class="account">
 
	                  ##  ${h.link_to('%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname),h.url('#'))}<br/>
 
	                  ##  ${h.link_to(c.rhodecode_user.username,h.url('#'))}
 
		            %if c.rhodecode_user.username == 'default':
 
                        ##${h.link_to('%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname),h.url('register'))}<br/>
 
                        ${h.link_to('anonymous',h.url('register'))}
 
                    %else:                        		            
 
		            	##${h.link_to('%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname),h.url('admin_settings_my_account'))}<br/>
 
		            	${h.link_to(c.rhodecode_user.username,h.url('admin_settings_my_account'))}
 
		            %endif
 
	                </div>  
 
	            </li>
 
	            <li>
 
	               <a href="${h.url('home')}">${_('Home')}</a>
 
	            </li>
 
                <li>
 
                   <a href="${h.url('journal')}">${_('Journal')}</a> 
 
                   ##(${c.unread_journal})</a>
 
                </li>	         
 
                %if c.rhodecode_user.username == 'default':
 
            <li class="last highlight">${h.link_to(u'Login',h.url('login_home'))}</li>
 
	        %else:
 
	            <li class="first">
 
	                <div class="gravatar">
 
	                    <img alt="gravatar" src="${h.gravatar_url(c.rhodecode_user.email,24)}" />
 
	                </div>
 
		            <div class="account">
 
		            	${h.link_to('%s %s'%(c.rhodecode_user.name,c.rhodecode_user.lastname),h.url('admin_settings_my_account'))}<br/>
 
		            	${h.link_to(c.rhodecode_user.username,h.url('admin_settings_my_account'))}
 
		            </div>	
 
	            </li>
 
	            <li class="last highlight">${h.link_to(u'Logout',h.url('logout_home'))}</li>
 
                    <li class="last highlight">${h.link_to(u'Log Out',h.url('logout_home'))}</li>
 
            %endif
 
	            
 
	            
 
        </ul>
 
        <!-- end user -->
 
        <div id="header-inner" class="title top-left-rounded-corner top-right-rounded-corner">
0 comments (0 inline, 0 general)