Add gold perks listing chooser tab.

This commit is contained in:
Max Goodman
2013-09-03 15:19:40 -07:00
parent 3d0e1971bf
commit a71bc6626c
5 changed files with 31 additions and 6 deletions

View File

@@ -610,3 +610,5 @@ goldvertisement_blurbs = "Make reddit better. Try %(reddit_gold)." "This year, g
goldvertisement_has_gold_blurbs = "**“Exquisite!”** \nGrab a drink and join us in [the lounge](/r/lounge)."
# sample multireddits (displayed when a user has no multis)
listing_chooser_sample_multis = /user/reddit/m/hello, /user/reddit/m/world
# multi of subreddits to share with gold users
listing_chooser_gold_multi = /user/reddit/m/gold

View File

@@ -229,6 +229,9 @@ class Globals(object):
'fastlane_links',
'listing_chooser_sample_multis',
],
ConfigValue.str: [
'listing_chooser_gold_multi',
],
ConfigValue.dict(ConfigValue.int, ConfigValue.float): [
'comment_tree_version_weights',
],

View File

@@ -4127,6 +4127,11 @@ class ListingChooser(Templated):
self.add_item("other", _("saved"), path='/user/%s/saved' % c.user.name)
gold_multi = g.live_config["listing_chooser_gold_multi"]
if c.user_is_loggedin and c.user.gold and gold_multi:
self.add_item("other", name=_("gold perks"), path=gold_multi,
extra_class="gold-perks")
self.show_samples = False
if c.user_is_loggedin:
multis = LabeledMulti.by_owner(c.user)
@@ -4142,13 +4147,15 @@ class ListingChooser(Templated):
if self.selected_item:
self.selected_item["selected"] = True
def add_item(self, section, name, path=None, site=None, description=None):
def add_item(self, section, name, path=None, site=None, description=None,
extra_class=None):
self.sections[section].append({
"name": name,
"description": description,
"path": path or site.user_path,
"site": site,
"selected": False,
"extra_class": extra_class,
})
def add_samples(self):

View File

@@ -7438,6 +7438,21 @@ body.with-listing-chooser {
border-left-color: lighten(#369, 25%);
}
}
&.gold-perks {
background: #fdfbf2;
a {
color: #9a7d2e;
}
&.selected {
border-color: lighten(#c4b487, 6%);
&:before {
border-left-color: lighten(#9a7d2e, 15%);
}
}
}
}

View File

@@ -20,13 +20,11 @@
## reddit Inc. All Rights Reserved.
###############################################################################
<%namespace file="utils.html" import="classes"/>
<%def name="section_items(itemlist)">
%for item in itemlist:
<li
%if item['selected']:
class="selected"
%endif
>
<li ${classes(item['extra_class'], 'selected' if item['selected'] else None)}>
<a href="${item['path']}">
${item['name']}
%if 'description' in item: