Skip to content

Commit

Permalink
Added boolean paramater 'selftext' to /submit urls, if true submit pa…
Browse files Browse the repository at this point in the history
…ge will default to displaying the 'text' tab.
  • Loading branch information
reddit committed Apr 12, 2012
1 parent 7db889b commit ab9ad7b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion r2/r2/controllers/front.py
Original file line number Diff line number Diff line change
Expand Up @@ -781,8 +781,9 @@ def GET_comment_by_id(self, comment):
@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:
Expand Down Expand Up @@ -814,6 +815,7 @@ def GET_submit(self, url, title, text, then):
content=NewLink(url=url or '',
title=title or '',
text=text or '',
selftext=selftext or '',
subreddits = sr_names,
captcha=captcha,
resubmit=resubmit,
Expand Down
4 changes: 2 additions & 2 deletions r2/r2/lib/pages/pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -1813,7 +1813,7 @@ def add_props(cls, user, 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
Expand All @@ -1830,7 +1830,7 @@ def __init__(self, captcha = None, url = '', title= '', text = '',
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]
Expand Down

0 comments on commit ab9ad7b

Please sign in to comment.