From a5a3d52bb00260d076339f48b76cabf69d574b02 Mon Sep 17 00:00:00 2001 From: Evgeny Fadeev Date: Sun, 5 Dec 2010 22:51:32 -0500 Subject: new badge system fully works but a few badges from SE are not yet implemented --- askbot/models/__init__.py | 5 +- askbot/models/badges.py | 23 +++++++--- askbot/skins/default/templates/base.html | 8 ++-- askbot/skins/default/templates/user_recent.html | 2 +- askbot/skins/default/templates/user_stats.html | 2 +- askbot/startup_procedures.py | 8 +++- askbot/tests/page_load_tests.py | 2 +- askbot/views/meta.py | 1 - askbot/views/users.py | 61 +++++-------------------- 9 files changed, 46 insertions(+), 66 deletions(-) diff --git a/askbot/models/__init__.py b/askbot/models/__init__.py index 93a8790d..722b4164 100644 --- a/askbot/models/__init__.py +++ b/askbot/models/__init__.py @@ -742,7 +742,10 @@ def user_retag_question( ) @auto_now_timestamp -def user_accept_best_answer(self, answer = None, timestamp = None): +def user_accept_best_answer(self, answer = None, + timestamp = None, cancel = False): + if cancel: + return self.unaccept_best_answer(answer = answer, timestamp = timestamp) self.assert_can_accept_best_answer(answer) if answer.accepted == True: return diff --git a/askbot/models/badges.py b/askbot/models/badges.py index 791dbd10..8cee2d6c 100644 --- a/askbot/models/badges.py +++ b/askbot/models/badges.py @@ -700,11 +700,20 @@ class FavoriteQuestion(FavoriteTypeBadge): return self ORIGINAL_DATA = """ - (_('Generalist'), 2, _('generalist'), _('Active in many different tags'), False, 0), - (_('Expert'), 2, _('expert'), _('Very active in one tag'), False, 0), + +extra badges from stackexchange +* commentator - left n comments (single) +* enthusiast, fanatic - visited site n days in a row (s) +* epic, legendary - hit daily reputation cap on n days (s) +* mortarboard - hit the daily reputation cap for the first time (s) +* populist - provided an answer that outscored an accepted answer two-fold or by n points, whichever is higher (m) +* reversal - provided an answer with +n points to a question of -m points (_('Taxonomist'), 2, _('taxonomist'), _('Created a tag used by 50 questions'), True, 0) - (_('Yearling'), 2, _('yearling'), _('Active member for a year'), False, 0), + + + (_('Generalist'), 2, _('generalist'), _('Active in many different tags'), False, 0), + (_('Expert'), 2, _('expert'), _('Very active in one tag'), False, 0), (_('Beta'), 2, _('beta'), _('Actively participated in the private beta'), False, 0), (_('Alpha'), 2, _('alpha'), _('Actively participated in the private alpha'), False, 0), """ @@ -712,10 +721,10 @@ ORIGINAL_DATA = """ BADGES = { 'strunk-and-white': AssociateEditor,#legacy slug name 'autobiographer': Autobiographer, - 'critic': Critic, + 'cleanup': Cleanup, 'citizen-patrol': CitizenPatrol, 'civic-duty': CivicDuty, - 'cleanup': Cleanup, + 'critic': Critic, 'disciplined': Disciplined, 'editor': Editor, 'enlightened': Enlightened, @@ -735,10 +744,10 @@ BADGES = { 'popular-question': PopularQuestion, 'pundit': Pundit, 'scholar': Scholar, - 'student': Student, - 'supporter': Supporter, 'self-learner': SelfLearner, 'stellar-question': StellarQuestion, + 'student': Student, + 'supporter': Supporter, 'teacher': Teacher, } diff --git a/askbot/skins/default/templates/base.html b/askbot/skins/default/templates/base.html index 1bf3e572..90ea1568 100644 --- a/askbot/skins/default/templates/base.html +++ b/askbot/skins/default/templates/base.html @@ -100,12 +100,12 @@ {% else %} $('#id_title').focus(); {% endif %} - {% if user_messages %} - $('#validate_email_alert').click(function(){notify.close(true)}) - notify.show(); - {% endif %} }); {% endif %} + {% if user_messages %} + $('#validate_email_alert').click(function(){notify.close(true)}) + notify.show(); + {% endif %} {% if settings.GOOGLE_ANALYTICS_KEY %}