Update landing page to use gravatar.

This commit is contained in:
yackob03 2013-09-27 18:15:31 -04:00
parent bf926aceee
commit 730f4f2d66
5 changed files with 21 additions and 1 deletions

View file

@ -7,6 +7,7 @@ from functools import wraps
from data import model from data import model
from app import app from app import app
from util.names import parse_repository_name from util.names import parse_repository_name
from util.gravatar import compute_hash
from auth.permissions import (ReadRepositoryPermission, from auth.permissions import (ReadRepositoryPermission,
ModifyRepositoryPermission, ModifyRepositoryPermission,
AdministerRepositoryPermission) AdministerRepositoryPermission)
@ -29,6 +30,7 @@ def get_logged_in_user():
'anonymous': False, 'anonymous': False,
'username': user.username, 'username': user.username,
'email': user.email, 'email': user.email,
'gravatar': compute_hash(user.email),
}) })

View file

@ -194,3 +194,12 @@ p.editable:hover i {
.repo .images { .repo .images {
margin: 10px; margin: 10px;
} }
.navbar-nav > li > .user-dropdown {
padding-top: 9px;
padding-bottom: 9px;
}
.user-dropdown > img {
padding-right: 6px;
}

View file

@ -58,7 +58,11 @@
<li class="dropdown" ng-switch-when="false"> <li class="dropdown" ng-switch-when="false">
<!--<button type="button" class="btn btn-default navbar-btn">Sign in</button>--> <!--<button type="button" class="btn btn-default navbar-btn">Sign in</button>-->
<a href="javascript:void(0)" class="dropdown-toggle" data-toggle="dropdown">{{ user.username }} <b class="caret"></b></a> <a href="javascript:void(0)" class="dropdown-toggle user-dropdown" data-toggle="dropdown">
<img src="http://www.gravatar.com/avatar/{{ user.gravatar }}?s=32&d=identicon" />
{{ user.username }}
<b class="caret"></b>
</a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li><a href="/signout">Sign out</a></li> <li><a href="/signout">Sign out</a></li>
</ul> </ul>

BIN
test.db

Binary file not shown.

5
util/gravatar.py Normal file
View file

@ -0,0 +1,5 @@
import hashlib
def compute_hash(email_address):
return hashlib.md5(email_address.strip().lower()).hexdigest()