From f7d0587cf8401b2778e616eae980589b760be44c Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Thu, 24 Apr 2014 18:37:34 -0700 Subject: [PATCH] Add /explore variant to next/prev suggestions. --- r2/r2/lib/pages/pages.py | 8 ++++++-- r2/r2/templates/listingsuggestions.html | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index 88d66dc95..4f0fa9123 100644 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -4337,8 +4337,14 @@ class SubredditSelector(Templated): class ListingSuggestions(Templated): def __init__(self): + Templated.__init__(self) + self.suggestion_type = None if c.default_sr: + if c.user_is_loggedin and random.randint(0, 1) == 1: + self.suggestion_type = "explore" + return + multis = c.user_is_loggedin and LabeledMulti.by_owner(c.user) if multis and c.site in multis: @@ -4353,8 +4359,6 @@ class ListingSuggestions(Templated): else: self.suggestion_type = "random" - Templated.__init__(self) - class ExploreItem(Templated): """For managing recommended content.""" diff --git a/r2/r2/templates/listingsuggestions.html b/r2/r2/templates/listingsuggestions.html index a8c7b8c78..7d5017c89 100644 --- a/r2/r2/templates/listingsuggestions.html +++ b/r2/r2/templates/listingsuggestions.html @@ -25,7 +25,10 @@ %if thing.suggestion_type: -%if thing.suggestion_type == 'multis': +%if thing.suggestion_type == 'explore': + ${_('or')} + ${_('explore some new subreddits')} +%elif thing.suggestion_type == 'multis': ${_('or try a multi:')} %for multi in thing.suggestions: /m/${multi.name}