##// END OF EJS Templates
Implemented basic gravatar support on admin pages only for now
marcink -
r398:8c50b164 default
parent child Browse files
Show More
@@ -277,8 +277,6 b' flash = _Flash()'
277 #===============================================================================
277 #===============================================================================
278 # MERCURIAL FILTERS available via h.
278 # MERCURIAL FILTERS available via h.
279 #===============================================================================
279 #===============================================================================
280
281
282 from mercurial import util
280 from mercurial import util
283 from mercurial.templatefilters import age as _age, person as _person
281 from mercurial.templatefilters import age as _age, person as _person
284
282
@@ -302,4 +300,24 b' time_ago = lambda x: util.datestr(_age(x'
302 from pylons_app.lib.auth import HasPermissionAny, HasPermissionAll, \
300 from pylons_app.lib.auth import HasPermissionAny, HasPermissionAll, \
303 HasRepoPermissionAny, HasRepoPermissionAll
301 HasRepoPermissionAny, HasRepoPermissionAll
304
302
303 #===============================================================================
304 # GRAVATAR URL
305 #===============================================================================
306 import hashlib
307 import urllib
305
308
309 def gravatar_url(email):
310 ssl_enabled = 'https' == request.environ.get('HTTP_X_URL_SCHEME')
311 default = 'identicon'
312 size = 32
313 baseurl_nossl = "http://www.gravatar.com/avatar/"
314 baseurl_ssl = "https://secure.gravatar.com/avatar/"
315
316 baseurl = baseurl_ssl if ssl_enabled else baseurl_nossl
317
318
319 # construct the url
320 gravatar_url = baseurl + hashlib.md5(email.lower()).hexdigest() + "?"
321 gravatar_url += urllib.urlencode({'d':default, 's':str(size)})
322
323 return gravatar_url
@@ -1899,6 +1899,7 b' div.form div.fields div.buttons input'
1899 padding: 5px;
1899 padding: 5px;
1900 background: #ffffff;
1900 background: #ffffff;
1901 border-bottom: 1px solid #cdcdcd;
1901 border-bottom: 1px solid #cdcdcd;
1902 vertical-align:middle;
1902 }
1903 }
1903
1904
1904 #content div.box table tr.selected td
1905 #content div.box table tr.selected td
@@ -3442,6 +3443,15 b' table#permissions_manage tr#add_perm_inp'
3442
3443
3443 }
3444 }
3444
3445
3446 /* -----------------------------------------------------------
3447 GRAVATARS
3448 ----------------------------------------------------------- */
3449 .gravatar_box img{
3450 float:left;
3451 padding-right: 5px;
3452 padding-top:3px;
3453 }
3454
3445
3455
3446 /* -----------------------------------------------------------
3456 /* -----------------------------------------------------------
3447 jquery ui
3457 jquery ui
@@ -29,6 +29,16 b''
29 <!-- fields -->
29 <!-- fields -->
30 <div class="fields">
30 <div class="fields">
31 <div class="field">
31 <div class="field">
32 <div class="gravatar_box">
33 <img alt="gravatar" src="${h.gravatar_url(c.user.email)}"/>
34 <p>
35 <strong>Change your avatar at <a href="http://gravatar.com">gravatar.com</a></strong><br/>
36 ${_('Using')} ${c.user.email}
37 </p>
38 </div>
39 </div>
40
41 <div class="field">
32 <div class="label">
42 <div class="label">
33 <label for="username">${_('Username')}:</label>
43 <label for="username">${_('Username')}:</label>
34 </div>
44 </div>
@@ -90,7 +100,6 b''
90 ${h.checkbox('admin',value=True)}
100 ${h.checkbox('admin',value=True)}
91 </div>
101 </div>
92 </div>
102 </div>
93
94 <div class="buttons">
103 <div class="buttons">
95 ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
104 ${h.submit('save','save',class_="ui-button ui-widget ui-state-default ui-corner-all")}
96 </div>
105 </div>
@@ -29,6 +29,7 b''
29 <div class="table">
29 <div class="table">
30 <table class="table_disp">
30 <table class="table_disp">
31 <tr class="header">
31 <tr class="header">
32 <th></th>
32 <th class="left">${_('username')}</th>
33 <th class="left">${_('username')}</th>
33 <th class="left">${_('name')}</th>
34 <th class="left">${_('name')}</th>
34 <th class="left">${_('lastname')}</th>
35 <th class="left">${_('lastname')}</th>
@@ -39,6 +40,7 b''
39 %for cnt,user in enumerate(c.users_list):
40 %for cnt,user in enumerate(c.users_list):
40 %if user.name !='default':
41 %if user.name !='default':
41 <tr class="parity${cnt%2}">
42 <tr class="parity${cnt%2}">
43 <td> <img alt="gravatar" src="${h.gravatar_url(user.email)}"> </td>
42 <td>${h.link_to(user.username,h.url('edit_user', id=user.user_id))}</td>
44 <td>${h.link_to(user.username,h.url('edit_user', id=user.user_id))}</td>
43 <td>${user.name}</td>
45 <td>${user.name}</td>
44 <td>${user.lastname}</td>
46 <td>${user.lastname}</td>
General Comments 0
You need to be logged in to leave comments. Login now