From 24fbb6597d52a40262625eacf25fe7c534272f1b Mon Sep 17 00:00:00 2001 From: Chase Sterling Date: Wed, 16 Dec 2015 00:30:33 -0500 Subject: [PATCH] Add avatars to history view. --- realms/modules/wiki/views.py | 7 +++++-- realms/templates/wiki/history.html | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/realms/modules/wiki/views.py b/realms/modules/wiki/views.py index 2d5025d..7c02c0a 100644 --- a/realms/modules/wiki/views.py +++ b/realms/modules/wiki/views.py @@ -2,7 +2,7 @@ import itertools import sys from flask import abort, g, render_template, request, redirect, Blueprint, flash, url_for, current_app from flask.ext.login import login_required, current_user -from realms.lib.util import to_canonical, remove_ext +from realms.lib.util import to_canonical, remove_ext, gravatar_url from .models import PageNotFound blueprint = Blueprint('wiki', __name__) @@ -66,7 +66,10 @@ def history(name): if current_app.config.get('PRIVATE_WIKI') and current_user.is_anonymous(): return current_app.login_manager.unauthorized() - return render_template('wiki/history.html', name=name, history=g.current_wiki.get_history(name)) + hist = g.current_wiki.get_history(name) + for item in hist: + item['gravatar'] = gravatar_url(item['author_email']) + return render_template('wiki/history.html', name=name, history=hist) @blueprint.route("/_edit/") diff --git a/realms/templates/wiki/history.html b/realms/templates/wiki/history.html index ebc6002..bdc0cc7 100644 --- a/realms/templates/wiki/history.html +++ b/realms/templates/wiki/history.html @@ -22,7 +22,7 @@ {% endif %} - {{ h.author }} + {{ h.author }} View {{ h.message }} {{ h.time|datetime }} @@ -57,4 +57,4 @@ }); }); -{% endblock %} \ No newline at end of file +{% endblock %}