# HG changeset patch # User Brian Neal # Date 1246473249 0 # Node ID fbef4f76492b7482d5400ca13ce3c40a8223a678 # Parent c0d3b09c9b95e5cf2944772ab02ad4fa45857672 Created a bool_icon template tag to graphically display an icon to represent yes/no. Updated profile template to use it. diff -r c0d3b09c9b95 -r fbef4f76492b gpp/core/templatetags/core_tags.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/gpp/core/templatetags/core_tags.py Wed Jul 01 18:34:09 2009 +0000 @@ -0,0 +1,19 @@ +""" +Miscellaneous/utility template tags. +""" +from django import template +from django.conf import settings + +register = template.Library() + +ICON_PARAMS = { + True: (settings.MEDIA_URL + 'icons/accept.png', 'Yes'), + False: (settings.MEDIA_URL + 'icons/delete.png', 'No'), +} + +@register.simple_tag +def bool_icon(flag): + params = ICON_PARAMS[bool(flag)] + return u"""%s""" % ( + params[0], params[1], params[1]) + diff -r c0d3b09c9b95 -r fbef4f76492b gpp/templates/bio/view_profile.html --- a/gpp/templates/bio/view_profile.html Wed Jul 01 17:57:11 2009 +0000 +++ b/gpp/templates/bio/view_profile.html Wed Jul 01 18:34:09 2009 +0000 @@ -1,6 +1,7 @@ {% extends 'bio/base.html' %} {% load avatar_tags %} {% load elsewhere_tags %} +{% load core_tags %} {% block title %}User Profile for {{ subject.username }}{% endblock %} {% block content %}
@@ -10,8 +11,8 @@ Full Name{{ subject.get_full_name }} Date Joined{{ subject.date_joined|date:"F d, Y" }} Last Login{{ subject.last_login|date:"F d, Y @ H:i" }} - Active Member{{ subject.is_active|yesno:"Yes,No" }} - Staff Member{{ subject.is_staff|yesno:"Yes,No" }} + Active Member{% bool_icon subject.is_active %} + Staff Member{% bool_icon subject.is_staff %} {% if profile.location %} Location{{ profile.location }} {% endif %} diff -r c0d3b09c9b95 -r fbef4f76492b media/icons/accept.png Binary file media/icons/accept.png has changed diff -r c0d3b09c9b95 -r fbef4f76492b media/icons/delete.png Binary file media/icons/delete.png has changed