Commits

Dan Watson committed 415a238

Allow default gravatar, show powered by logo

Comments (0)

Files changed (5)

leaves/templatetags/comments.py

 	return format_text(comment.comment, 'markdown', safe_mode='escape')
 
 @register.simple_tag
-def gravatar_url(email, size=40):
+def gravatar_url(email, size=40, default=None):
 	try:
 		code = hashlib.md5(email.strip().lower()).hexdigest()
-		url = 'http://www.gravatar.com/avatar/' + code + '?'
-		url += urllib.urlencode({'s': str(size)})
-		return url
+		params = {'s': str(size)}
+		if default:
+			params['d'] = default
+		return 'http://www.gravatar.com/avatar/' + code + '?' + urllib.urlencode(params)
 	except:
 		return ''

leaves/themes/stream/static/stream/css/style.css

 
 h1, h2, h3, h4 { margin-top: 0px; }
 
+.powered {
+    margin-left: 35px;
+}
+.powered:hover { border: 0 !important; }
+.powered img {
+    border: 0;
+    width: 100px;
+}
+
 .container {
     width: 940px;
     margin: 0px auto;

leaves/themes/stream/static/stream/img/powered-by-leaves.png

Added
New image

leaves/themes/stream/templates/base.html

 				</form>
 			</div>
 		</div>
+		<a href="http://leaves-cms.org/" class="powered"><img src="{{ THEME_STATIC_URL }}img/powered-by-leaves.png" /></a>
 	</div>
 	<div id="content">
 	{% block content-header %}{% endblock %}

leaves/themes/stream/templates/comment.html

 {% load comments %}
 <div class="comment{% if comment.author_user.is_staff %} staff{% endif %}" id="comment-{{ comment.pk }}">
-	<img src="{% gravatar_url comment.email 50 %}" alt="{{ comment.author_name }}" class="avatar" />
+	<img src="{% gravatar_url comment.email 50 "identicon" %}" alt="{{ comment.author_name }}" class="avatar" />
     <div class="comment-byline">
         <span class="from">{% if comment.website %}<a href="{{ comment.website }}">{{ comment.author_name }}</a>{% else %}{{ comment.author_name }}{% endif %}</span>
         {% if comment.title %}<span class="title">{{ comment.title }}</span>{% endif %}