From f5f883ab101be733caa56ee5ff3e4ffb7225ac3d Mon Sep 17 00:00:00 2001 From: hernani Date: Sat, 26 Jun 2010 18:29:05 +0000 Subject: [PATCH] Adds optional status diamonds next to the usernames. git-svn-id: http://svn.osqa.net/svnroot/osqa/trunk@448 0cfe37f9-358a-4d5e-be75-b63607b5c754 --- forum/models/user.py | 11 +++++++++++ forum/modules/__init__.py | 2 +- forum/settings/users.py | 8 +++++++- .../default/templates/node/contributors_info.html | 4 ++-- forum/skins/default/templates/users/info.html | 2 +- forum/skins/default/templates/users/signature.html | 4 ++-- 6 files changed, 24 insertions(+), 7 deletions(-) diff --git a/forum/models/user.py b/forum/models/user.py index f5eb9a6..a1481b3 100644 --- a/forum/models/user.py +++ b/forum/models/user.py @@ -129,6 +129,17 @@ class User(BaseModel, DjangoUser): #todo: temporary thing, for now lets just assume that the site owner will always be the first user of the application return self.id == 1 + @property + def decorated_name(self): + if settings.SHOW_STATUS_DIAMONDS: + if self.is_superuser: + return u"%s \u2666\u2666" % self.username + + if self.is_staff: + return u"%s \u2666" % self.username + + return self.username + @property def gravatar(self): return md5(self.email).hexdigest() diff --git a/forum/modules/__init__.py b/forum/modules/__init__.py index 14c56e8..77a266f 100644 --- a/forum/modules/__init__.py +++ b/forum/modules/__init__.py @@ -26,7 +26,7 @@ def get_modules_script(script_name): try: all.append(__import__('%s.%s' % (m.__name__, script_name), globals(), locals(), [m.__name__])) except ImportError, e: - #repr(type(e)) + m.__name__ + ":" + str(e) + #print repr(type(e)) + m.__name__ + ":" + str(e) pass except: pass diff --git a/forum/settings/users.py b/forum/settings/users.py index 07f47b6..1645948 100644 --- a/forum/settings/users.py +++ b/forum/settings/users.py @@ -21,6 +21,11 @@ label = _("Disabled usernames"), help_text = _("A comma separated list of disabled usernames (usernames not allowed during a new user registration)."), widget=CommaStringListWidget)) +SHOW_STATUS_DIAMONDS = Setting('SHOW_STATUS_DIAMONDS', True, USERS_SET, dict( +label=_("Show status diamonds"), +help_text = _("Show status \"diamonds\" next to moderators or superusers usernames.") +)) + EMAIL_UNIQUE = Setting('EMAIL_UNIQUE', True, USERS_SET, dict( label = _("Force unique email"), help_text = _("Should each user have an unique email."))) @@ -41,4 +46,5 @@ help_text=_("How much time in minutes a post should be kept in session until the WARN_PENDING_POSTS_MINUTES = Setting('WARN_PENDING_POSTS_MINUTES', 15, USERS_SET, dict( 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.") -)) \ No newline at end of file +)) + diff --git a/forum/skins/default/templates/node/contributors_info.html b/forum/skins/default/templates/node/contributors_info.html index 0c40cf2..80121ea 100644 --- a/forum/skins/default/templates/node/contributors_info.html +++ b/forum/skins/default/templates/node/contributors_info.html @@ -5,7 +5,7 @@ {% diff_date node.added_at %}

{% gravatar node.author 32 %} -

{{ node.author.username }}
+

{{ node.author.decorated_name }}
{% get_score_badge node.author %}

{% if node.last_edited %} @@ -18,7 +18,7 @@

{% ifnotequal node.author node.last_edited.by %} {% gravatar node.last_edited.by 32 %} -

{{ node.last_edited.by.username }}
+

{{ node.last_edited.by.decorated_name }}
{% get_score_badge node.last_edited.by %}

{% endifnotequal %} diff --git a/forum/skins/default/templates/users/info.html b/forum/skins/default/templates/users/info.html index 8ffc7fa..e14cbf8 100644 --- a/forum/skins/default/templates/users/info.html +++ b/forum/skins/default/templates/users/info.html @@ -8,7 +8,7 @@ {% load user_tags %}
- {{view_user.username}} + {{view_user.decorated_name}}
diff --git a/forum/skins/default/templates/users/signature.html b/forum/skins/default/templates/users/signature.html index 2bf9aad..9805429 100644 --- a/forum/skins/default/templates/users/signature.html +++ b/forum/skins/default/templates/users/signature.html @@ -4,7 +4,7 @@ {% ifequal format "full" %} {% else %} - {{ user.username }} + {{ user.decorated_name }}{{ user.reputation }} {% ifequal format "badges" %} {% if user.gold %} @@ -28,6 +28,6 @@ {% endifequal %} {% endifequal %} {% else %} - {{ user.username }}{% trans "(suspended)" %} + {{ user.decorated_name }}{% trans "(suspended)" %} {% endif %} {% endspaceless %} -- 2.39.5