diff --git a/r2/r2/models/account.py b/r2/r2/models/account.py index 3554f19f8..ba61526db 100644 --- a/r2/r2/models/account.py +++ b/r2/r2/models/account.py @@ -31,6 +31,7 @@ from r2.lib import filters from r2.lib.log import log_text from pylons import g +from pylons.i18n import _ import time, sha from copy import copy from datetime import datetime, timedelta @@ -159,7 +160,7 @@ class Account(Thing): return True def all_karmas(self): - """returns a list of tuples in the form (name, link_karma, + """returns a list of tuples in the form (name, hover-text, link_karma, comment_karma)""" link_suffix = '_link_karma' comment_suffix = '_comment_karma' @@ -171,19 +172,18 @@ class Account(Thing): elif k.endswith(comment_suffix): sr_names.add(k[:-len(comment_suffix)]) for sr_name in sr_names: - karmas.append((sr_name, + karmas.append((sr_name, None, self._t.get(sr_name + link_suffix, 0), self._t.get(sr_name + comment_suffix, 0))) - karmas.sort(key = lambda x: abs(x[1] + x[2]), reverse=True) + karmas.sort(key = lambda x: abs(x[2] + x[3]), reverse=True) - karmas.insert(0, ('total', - self.karma('link'), - self.karma('comment'))) - - karmas.append(('old', - self._t.get('link_karma', 0), - self._t.get('comment_karma', 0))) + old_link_karma = self._t.get('link_karma', 0) + old_comment_karma = self._t.get('comment_karma', 0) + if old_link_karma or old_comment_karma: + karmas.append((_('ancient history'), + _('really obscure karma from before it was cool to track per-subreddit'), + old_link_karma, old_comment_karma)) return karmas diff --git a/r2/r2/public/static/css/reddit.css b/r2/r2/public/static/css/reddit.css index 3f59dadce..c18a67365 100644 --- a/r2/r2/public/static/css/reddit.css +++ b/r2/r2/public/static/css/reddit.css @@ -4605,6 +4605,57 @@ tr.gold-accent + tr > td { padding-top: 10px; } +#per-sr-karma { + width: 300px; + margin: .6em auto 0 auto; + table-layout: fixed; +} + +#per-sr-karma thead th, +#per-sr-karma td { + text-align: right; +} + +#per-sr-karma tbody th { + text-align: left; +} + +#per-sr-karma #sr-karma-header { + width: 150px; + text-align: left; +} + +#per-sr-karma thead th { + font-weight: bold; + padding-bottom: 2px; +} + +#per-sr-karma tbody th { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; + -o-text-overflow: ellipsis; +} + +#per-sr-karma tbody td { + font-weight: bold; + color: #666; +} + +#per-sr-karma th.helpful span { + border-bottom: 1px dotted #666; + cursor: help; + display: inline-block; +} + +.more-karmas { + display: none; +} + +.giftgold.karma-breakdown { + margin-top: .6em; +} + .friend-note button[type=submit] { display: none; font-size: x-small; diff --git a/r2/r2/templates/profilebar.html b/r2/r2/templates/profilebar.html index 444c54629..db35bb0b5 100644 --- a/r2/r2/templates/profilebar.html +++ b/r2/r2/templates/profilebar.html @@ -58,42 +58,57 @@ %endif - %if c.user_is_admin: -
| subreddit | +link | +comment | +|||||
|---|---|---|---|---|---|---|---|
| ${label}: | -${lc} | -/ | -${cc} | + % if title: +${label} | + % else: +${label} | + % endif +${lc} | +${cc} |