From 4e6a2b05ba6897f00356ef806aef0990004a813d Mon Sep 17 00:00:00 2001 From: Andre D Date: Thu, 11 Aug 2011 10:58:52 -0700 Subject: [PATCH] Add option for showing subreddit sidebars on cnames. --- r2/r2/controllers/api.py | 3 ++- r2/r2/lib/pages/pages.py | 4 ++-- r2/r2/models/subreddit.py | 1 + r2/r2/templates/createsubreddit.html | 7 +++++++ 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/r2/r2/controllers/api.py b/r2/r2/controllers/api.py index f49699ceb..cd1de8d6a 100644 --- a/r2/r2/controllers/api.py +++ b/r2/r2/controllers/api.py @@ -1274,6 +1274,7 @@ class ApiController(RedditController): over_18 = VBoolean('over_18'), allow_top = VBoolean('allow_top'), show_media = VBoolean('show_media'), + show_cname_sidebar = VBoolean('show_cname_sidebar'), type = VOneOf('type', ('public', 'private', 'restricted')), link_type = VOneOf('link_type', ('any', 'link', 'self')), ip = ValidIP(), @@ -1290,7 +1291,7 @@ class ApiController(RedditController): redir = False kw = dict((k, v) for k, v in kw.iteritems() if k in ('name', 'title', 'domain', 'description', 'over_18', - 'show_media', 'type', 'link_type', 'lang', + 'show_media', 'show_cname_sidebar', 'type', 'link_type', 'lang', "css_on_cname", "header_title", 'allow_top')) diff --git a/r2/r2/lib/pages/pages.py b/r2/r2/lib/pages/pages.py index 5306899d3..9a0efa266 100644 --- a/r2/r2/lib/pages/pages.py +++ b/r2/r2/lib/pages/pages.py @@ -221,8 +221,8 @@ class Reddit(Templated): if srs: ps.append(SideContentBox(_('these reddits'),[SubscriptionBox(srs=srs)])) - if not isinstance(c.site, FakeSubreddit) and not c.cname: - #don't show the subreddit info bar on cnames + # don't show the subreddit info bar on cnames unless the option is set + if not isinstance(c.site, FakeSubreddit) and (not c.cname or c.site.show_cname_sidebar): ps.append(SubredditInfoBar()) if (c.user.pref_show_adbox or not c.user.gold) and not g.disable_ads: ps.append(Ads()) diff --git a/r2/r2/models/subreddit.py b/r2/r2/models/subreddit.py index dfb0d2d8f..0770277c5 100644 --- a/r2/r2/models/subreddit.py +++ b/r2/r2/models/subreddit.py @@ -62,6 +62,7 @@ class Subreddit(Thing, Printable): reported = 0, valid_votes = 0, show_media = False, + show_cname_sidebar = False, css_on_cname = True, domain = None, over_18 = False, diff --git a/r2/r2/templates/createsubreddit.html b/r2/r2/templates/createsubreddit.html index 81124899c..e6ee2b278 100644 --- a/r2/r2/templates/createsubreddit.html +++ b/r2/r2/templates/createsubreddit.html @@ -169,6 +169,13 @@ +
+ + %endif