Seperate "description" and "sidebar" for subreddits.

This commit is contained in:
Neil Williams
2012-05-21 17:03:36 -07:00
parent ac78f0b153
commit dbdf637d9f
9 changed files with 30 additions and 12 deletions

View File

@@ -1368,6 +1368,7 @@ class ApiController(RedditController):
title = VLength("title", max_length = 100),
header_title = VLength("header-title", max_length = 500),
domain = VCnameDomain("domain"),
public_description = VMarkdown("public_description", max_length = 500),
description = VMarkdown("description", max_length = 5120),
lang = VLang("lang"),
over_18 = VBoolean('over_18'),
@@ -1393,7 +1394,7 @@ class ApiController(RedditController):
if k in ('name', 'title', 'domain', 'description', 'over_18',
'show_media', 'show_cname_sidebar', 'type', 'link_type', 'lang',
"css_on_cname", "header_title",
'allow_top'))
'allow_top', 'public_description'))
#if a user is banned, return rate-limit errors
if c.user._spam:
@@ -1419,6 +1420,7 @@ class ApiController(RedditController):
elif form.has_errors('domain', errors.BAD_CNAME, errors.USED_CNAME):
form.find('#example_domain').hide()
elif (form.has_errors(('type', 'link_type'), errors.INVALID_OPTION) or
form.has_errors('public_description', errors.TOO_LONG) or
form.has_errors('description', errors.TOO_LONG)):
pass

View File

@@ -212,6 +212,7 @@ class SubredditJsonTemplate(ThingJsonTemplate):
url = "path",
over18 = "over_18",
description = "description",
public_description = "public_description",
display_name = "name",
header_img = "header",
header_size = "header_size",

View File

@@ -69,7 +69,8 @@ class ModAction(tdb_cassandra.UuidThing, Printable):
'remove_self': _('removed self'),
# editsettings
'title': _('title'),
'description': _('description'),
'public_description': _('description'),
'description': _('sidebar'),
'lang': _('language'),
'type': _('type'),
'link_type': _('link type'),

View File

@@ -57,6 +57,7 @@ class Subreddit(Thing, Printable):
header_size = None,
header_title = "",
allow_top = False, # overridden in "_new"
public_description = '',
description = '',
images = {},
reported = 0,
@@ -388,7 +389,11 @@ class Subreddit(Thing, Printable):
#will seem less horrible when add_props is in pages.py
from r2.lib.pages import UserText
item.usertext = UserText(item, item.description, target=target)
item.description_usertext = UserText(item, item.description, target=target)
if item.public_description or item.description:
item.public_description_usertext = UserText(item, item.public_description or item.description, target=target)
else:
item.public_description_usertext = None
Printable.add_props(user, wrapped)

View File

@@ -66,7 +66,16 @@
</%utils:line_field>
<%utils:line_field title="${_('description')}" css_class="usertext"
description="${_('500 characters max. Make them count.')}">
description="${_('publicly describe your subreddit for all to see. 500 characters max.')}">
%if thing.site and thing.site.public_description:
${UserText(None, text=thing.site.public_description or "", editable=True, creating=True, name="public_description", have_form=False)}
%else:
${UserText(None, text="", creating=True, name="public_description", have_form=False)}
%endif
</%utils:line_field>
<%utils:line_field title="${_('sidebar')}" css_class="usertext"
description="${_('shown in the sidebar of your subreddit. 5120 characters max.')}">
%if thing.site and thing.site.description:
${UserText(None, text = thing.site.description or "", editable = True, creating = True, name="description", have_form = False)}
%else:

View File

@@ -43,7 +43,7 @@
reverse = thing.subscriber)}
</div>
<div class="entry ${like_cls}">
%if thing.description:
%if thing.public_description or thing.description:
<a href="javascript:void(0)" class="expando-button collapsed button">
Aa
</a>
@@ -55,10 +55,10 @@
<p class="tagline">
${tagline()}
</p>
%if thing.description:
%if thing.public_description_usertext:
<div class="expando" style="display:none">
<div class="description">
${thing.usertext}
${thing.public_description_usertext}
</div>
</div>
%endif

View File

@@ -42,9 +42,9 @@
${self.admintagline()}
%endif
</p>
%if thing.description:
%if thing.public_description_usertext:
<div class="description">
${thing.usertext}
${thing.public_description_usertext}
</div>
%endif
<p class="tagline">

View File

@@ -26,8 +26,8 @@
<guid>${thing.path}</guid>
<dc:date>${thing._date.isoformat()}</dc:date>
<description>
%if thing.description:
${thing.description}
%if thing.public_description:
${thing.public_description}
%endif
&lt;a href="${thing.path}"&gt;[link]&lt;/a&gt;
</description>

View File

@@ -64,7 +64,7 @@
%endif
%if thing.sr.description:
${thing.sr.usertext}
${thing.sr.description_usertext}
%endif
<div class="bottom">