From 90fb87da88c8ec8118198e89dec9a8deda94d39f Mon Sep 17 00:00:00 2001 From: Jason Harvey Date: Tue, 21 Aug 2012 18:56:35 -0700 Subject: [PATCH] Modify display of accounts_active info. This now relies on the fudged number from subreddit.py for obscurity. Rewords the default text, and title text of the metric. Adds a "fudged" class to the block so that low values can be hidden through CSS. --- r2/r2/lib/pages/pages.py | 2 ++ r2/r2/lib/strings.py | 6 +++--- r2/r2/templates/subredditinfobar.html | 8 ++------ 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index a0682d3a3..54e4f510f 100755 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -557,6 +557,8 @@ class SubredditInfoBar(CachedTemplate): # so the menus cache properly self.path = request.path + self.accounts_active, self.accounts_active_fuzzed = self.sr.get_accounts_active() + if c.user_is_loggedin and c.user.pref_show_flair: self.flair_prefs = FlairPrefs() else: diff --git a/r2/r2/lib/strings.py b/r2/r2/lib/strings.py index 40db1d15b..3b27fb8a8 100644 --- a/r2/r2/lib/strings.py +++ b/r2/r2/lib/strings.py @@ -275,7 +275,7 @@ plurals = PluralManager([P_("comment", "comments"), P_("subscriber", "subscribers"), P_("approved submitter", "approved submitters"), P_("moderator", "moderators"), - P_("user online", "users online"), + P_("user here now", "users here now"), # time words P_("milliseconds","milliseconds"), @@ -325,8 +325,8 @@ class Score(object): return strings.number_label % dict(num=x, thing=f(x)) @staticmethod - def users_online(x, prepend=''): - return Score._people(x, plurals.N_users_online, prepend=prepend) + def users_here_now(x, prepend=''): + return Score._people(x, plurals.N_users_here_now, prepend=prepend) @staticmethod def none(x): diff --git a/r2/r2/templates/subredditinfobar.html b/r2/r2/templates/subredditinfobar.html index 524780832..23b170c0c 100644 --- a/r2/r2/templates/subredditinfobar.html +++ b/r2/r2/templates/subredditinfobar.html @@ -36,12 +36,8 @@ ${addremove_button(thing.sr)} ${unsafe(Score.readers(thing.subscribers))} -

- %if thing.sr.accounts_active < 100 and not c.user_is_admin: - ${unsafe(Score.users_online(100, prepend='<'))} - %else: - ${unsafe(Score.users_online(thing.sr.accounts_active))} - %endif +

+ ${unsafe(Score.users_here_now(thing.accounts_active, prepend='~' if thing.accounts_active_fuzzed else ''))}

%if thing.sr.moderator: