This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Add class to the top bar random button for breadcrumb tracking.

  • Loading branch information...
chromakode authored and spladug committed Aug 1, 2012
1 parent 0a70249 commit d77c53fa4405bf74b9f27a6d951a024604427ac6
Showing with 5 additions and 3 deletions.
  1. +2 −2 r2/r2/lib/menus.py
  2. +3 −1 r2/r2/lib/pages/pages.py
View
@@ -339,11 +339,11 @@ class SubredditButton(NavButton):
# TRANSLATORS: This refers to the user's front page
Frontpage: _("front")}
- def __init__(self, sr):
+ def __init__(self, sr, **kw):
self.path = sr.path
name = self.name_overrides.get(sr, sr.name)
NavButton.__init__(self, name, sr.path, False,
- isselected = (c.site == sr))
+ isselected = (c.site == sr), **kw)
def build(self, base_path = ''):
pass
View
@@ -1454,6 +1454,7 @@ def popular_reddits(self, exclude=[]):
css_class = 'sr-bar', _id = 'sr-bar')
def special_reddits(self):
+ css_classes = {Random: "random"}
reddits = [Frontpage, All, Random]
if getattr(c.site, "over_18", False):
reddits.append(RandomNSFW)
@@ -1462,7 +1463,8 @@ def special_reddits(self):
reddits.append(Friends)
if c.show_mod_mail:
reddits.append(Mod)
- return NavMenu([SubredditButton(sr) for sr in reddits],
+ return NavMenu([SubredditButton(sr, css_class=css_classes.get(sr))
+ for sr in reddits],
type = 'flatlist', separator = '-',
css_class = 'sr-bar')

0 comments on commit d77c53f

Please sign in to comment.