From: hernani Date: Thu, 15 Jul 2010 11:18:45 +0000 (+0000) Subject: Closes OSQA 320, True Gravatar Support. X-Git-Tag: live~603 X-Git-Url: https://git.openstreetmap.org./osqa.git/commitdiff_plain/10c37b22084e296a86a4fc13eb4f5fb2a15bdd8b?ds=sidebyside Closes OSQA 320, True Gravatar Support. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@531 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- diff --git a/forum/settings/users.py b/forum/settings/users.py index 926d414..2a79942 100644 --- a/forum/settings/users.py +++ b/forum/settings/users.py @@ -1,5 +1,6 @@ from forms import CommaStringListWidget from django.forms import CheckboxSelectMultiple +from django.forms.widgets import RadioSelect from base import Setting, SettingSet from django.utils.translation import ugettext as _ @@ -54,3 +55,31 @@ label=_("Warn about pending posts afer X minutes"), help_text=_("How much time in minutes a user that just logged in or validated his email should be warned about a pending post instead of publishing it automatically.") )) +GRAVATAR_RATING_CHOICES = ( + ('g', _('suitable for display on all websites with any audience type.')), + ('pg', _('may contain rude gestures, provocatively dressed individuals, the lesser swear words, or mild violence.')), + ('r', _('may contain such things as harsh profanity, intense violence, nudity, or hard drug use.')), + ('x', _('may contain hardcore sexual imagery or extremely disturbing violence.')), +) + +GRAVATAR_ALLOWED_RATING = Setting('GRAVATAR_ALLOWED_RATING', 'g', USERS_SET, dict( +label = _("Gravatar rating"), +help_text = _("Gravatar allows users to self-rate their images so that they can indicate if an image is appropriate for a certain audience."), +widget=RadioSelect, +choices=GRAVATAR_RATING_CHOICES, +required=False)) + +GRAVATAR_DEFAULT_CHOICES = ( + ('mm', _('(mystery-man) a simple, cartoon-style silhouetted outline of a person (does not vary by email hash)')), + ('identicon', _('a geometric pattern based on an email hash')), + ('monsterid', _('a generated "monster" with different colors, faces, etc')), + ('wavatar', _('generated faces with differing features and backgrounds')), +) + +GRAVATAR_DEFAULT_IMAGE = Setting('GRAVATAR_DEFAULT_IMAGE', 'identicon', USERS_SET, dict( +label = _("Gravatar default"), +help_text = _("Gravatar has a number of built in options which you can also use as defaults."), +widget=RadioSelect, +choices=GRAVATAR_DEFAULT_CHOICES, +required=False)) + diff --git a/forum/templatetags/extra_tags.py b/forum/templatetags/extra_tags.py index 302412f..5602392 100644 --- a/forum/templatetags/extra_tags.py +++ b/forum/templatetags/extra_tags.py @@ -22,7 +22,7 @@ register = template.Library() GRAVATAR_TEMPLATE = ('') @register.simple_tag @@ -36,6 +36,8 @@ def gravatar(user, size): return mark_safe(GRAVATAR_TEMPLATE % { 'size': size, 'gravatar_hash': gravatar, + 'default': settings.GRAVATAR_DEFAULT_IMAGE, + 'rating': settings.GRAVATAR_ALLOWED_RATING, 'username': template.defaultfilters.urlencode(username), })