diff --git a/pylons_app/lib/helpers.py b/pylons_app/lib/helpers.py --- a/pylons_app/lib/helpers.py +++ b/pylons_app/lib/helpers.py @@ -277,8 +277,6 @@ flash = _Flash() #=============================================================================== # MERCURIAL FILTERS available via h. #=============================================================================== - - from mercurial import util from mercurial.templatefilters import age as _age, person as _person @@ -302,4 +300,24 @@ time_ago = lambda x: util.datestr(_age(x from pylons_app.lib.auth import HasPermissionAny, HasPermissionAll, \ HasRepoPermissionAny, HasRepoPermissionAll +#=============================================================================== +# GRAVATAR URL +#=============================================================================== +import hashlib +import urllib +def gravatar_url(email): + ssl_enabled = 'https' == request.environ.get('HTTP_X_URL_SCHEME') + default = 'identicon' + size = 32 + baseurl_nossl = "http://www.gravatar.com/avatar/" + baseurl_ssl = "https://secure.gravatar.com/avatar/" + + baseurl = baseurl_ssl if ssl_enabled else baseurl_nossl + + + # construct the url + gravatar_url = baseurl + hashlib.md5(email.lower()).hexdigest() + "?" + gravatar_url += urllib.urlencode({'d':default, 's':str(size)}) + + return gravatar_url diff --git a/pylons_app/public/css/style.css b/pylons_app/public/css/style.css --- a/pylons_app/public/css/style.css +++ b/pylons_app/public/css/style.css @@ -1899,6 +1899,7 @@ div.form div.fields div.buttons input padding: 5px; background: #ffffff; border-bottom: 1px solid #cdcdcd; + vertical-align:middle; } #content div.box table tr.selected td @@ -3442,6 +3443,15 @@ table#permissions_manage tr#add_perm_inp } +/* ----------------------------------------------------------- + GRAVATARS +----------------------------------------------------------- */ +.gravatar_box img{ + float:left; + padding-right: 5px; + padding-top:3px; +} + /* ----------------------------------------------------------- jquery ui diff --git a/pylons_app/templates/admin/users/user_edit.html b/pylons_app/templates/admin/users/user_edit.html --- a/pylons_app/templates/admin/users/user_edit.html +++ b/pylons_app/templates/admin/users/user_edit.html @@ -29,6 +29,16 @@
+
+ gravatar +

+ Change your avatar at gravatar.com
+ ${_('Using')} ${c.user.email} +

+
+
+ +
@@ -90,7 +100,6 @@ ${h.checkbox('admin',value=True)}
-
${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
diff --git a/pylons_app/templates/admin/users/users.html b/pylons_app/templates/admin/users/users.html --- a/pylons_app/templates/admin/users/users.html +++ b/pylons_app/templates/admin/users/users.html @@ -29,6 +29,7 @@
+ @@ -39,6 +40,7 @@ %for cnt,user in enumerate(c.users_list): %if user.name !='default': +
${_('username')} ${_('name')} ${_('lastname')}
gravatar ${h.link_to(user.username,h.url('edit_user', id=user.user_id))} ${user.name} ${user.lastname}