Permalink
Browse files

gravatars. fixes #15.

  • Loading branch information...
1 parent 4d9d4d3 commit 8bdd984b214ba0517bc7f4ab63dbc6c0fb4d1c57 @ralphbean committed Apr 30, 2012
Showing with 35 additions and 1 deletion.
  1. +9 −0 tahrir/model.py
  2. +20 −0 tahrir/static/css/tahrir.css
  3. +6 −1 tahrir/templates/index.mak
View
@@ -77,6 +77,15 @@ class Person(DeclarativeBase):
email = Column(Unicode(128), nullable=False, unique=True)
assertions = relationship("Assertion", backref="person")
+ @property
+ def gravatar_link(self):
+ d='mm'
+ s=24
+ hash = hashlib.md5(self.email).hexdigest()
+ url = "http://www.gravatar.com/avatar/%s?s=%i&d=%s" % (hash, s, d)
+ return url
+
+
def __unicode__(self):
return self.email
@@ -56,3 +56,23 @@ table {
td {
padding: 5px;
}
+
+div.gravatar {
+ display: inline-block;
+ width: 24px;
+ height: 24px;
+ -webkit-box-shadow: 1px 1px 2px rgba(0,0,0,.5);
+ -moz-box-shadow: 1px 1px 2px rgba(0,0,0,.5);
+
+ /* The next two lines are for IE.. silly IE */
+ zoom: 1;
+ filter: progid:DXImageTransform.Microsoft.Shadow(color='#969696', Direction=135, Strength=3);
+
+ padding: 2px;
+ margin: 1px;
+ background: white;
+};
+div.gravatar img {
+ max-width: 100%;
+ max-height: 100%;
+}
@@ -13,11 +13,16 @@
% for badge in issuer.badges:
<tr>
<td>${badge.name}</td>
- <td><img class="badge" src="/pngs/${badge.image}"></img>
+ <td><img class="badge"
+ src="/pngs/${badge.image}"></img></td>
<td>
<ul>
% for a in badge.assertions:
<li>
+ <div class="gravatar">
+ <img class="gravatar"
+ src="${a.person.gravatar_link}"></img>
+ </div>
<a href="/assertions/${badge.id}/${a.recipient}">
${a.recipient[:6]}
</a>

0 comments on commit 8bdd984

Please sign in to comment.