Add option for showing subreddit sidebars on cnames.

This commit is contained in:
Andre D
2011-08-11 10:58:52 -07:00
committed by Max Goodman
parent af9f5d0ecd
commit 4e6a2b05ba
4 changed files with 12 additions and 3 deletions

View File

@@ -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'))

View File

@@ -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())

View File

@@ -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,

View File

@@ -169,6 +169,13 @@
<label for="css_on_cname">
${_("make custom CSS styles apply only when accessed from the cname.")}
</label>
<br/>
<input class="nomargin" type="checkbox"
name="show_cname_sidebar" id="show_cname_sidebar"
${thing.site and thing.site.show_cname_sidebar and "checked='checked'" or ""}/>
<label for="show_cname_sidebar">
${_("show sidebar when accessed from the cname.")}
</label>
%endif
</div>
<div class="usertext-edit">