Added boolean paramater 'selftext' to /submit urls, if true submit page will default to displaying the 'text' tab.

This commit is contained in:
DEADB33F
2012-04-12 21:44:04 +01:00
committed by Logan Hanks
parent 9605865b5d
commit a9aa4ac578
2 changed files with 5 additions and 3 deletions

View File

@@ -781,8 +781,9 @@ class FrontController(RedditController):
@validate(url = VRequired('url', None),
title = VRequired('title', None),
text = VRequired('text', None),
selftext = VRequired('selftext', None),
then = VOneOf('then', ('tb','comments'), default = 'comments'))
def GET_submit(self, url, title, text, then):
def GET_submit(self, url, title, text, selftext, then):
"""Submit form."""
resubmit = request.get.get('resubmit')
if url and not resubmit:
@@ -814,6 +815,7 @@ class FrontController(RedditController):
content=NewLink(url=url or '',
title=title or '',
text=text or '',
selftext=selftext or '',
subreddits = sr_names,
captcha=captcha,
resubmit=resubmit,

View File

@@ -1817,7 +1817,7 @@ class FrameToolbar(Wrapped):
class NewLink(Templated):
"""Render the link submission form"""
def __init__(self, captcha = None, url = '', title= '', text = '',
def __init__(self, captcha = None, url = '', title= '', text = '', selftext = '',
subreddits = (), then = 'comments', resubmit=False):
self.show_link = self.show_self = False
@@ -1834,7 +1834,7 @@ class NewLink(Templated):
all_fields = set(chain(*(parts for (tab, parts) in tabs)))
buttons = []
if text != '':
if selftext == 'true' or text != '':
self.default_tab = tabs[1][0]
else:
self.default_tab = tabs[0][0]