Permalink
Browse files

Added boolean paramater 'selftext' to /submit urls, if true submit pa…

…ge will default to displaying the 'text' tab.
  • Loading branch information...
1 parent 7db889b commit ab9ad7ba9acea4fbff95beb1ea32e050c51d5469 reddit committed Apr 12, 2012
Showing with 5 additions and 3 deletions.
  1. +3 −1 r2/r2/controllers/front.py
  2. +2 −2 r2/r2/lib/pages/pages.py
View
4 r2/r2/controllers/front.py
@@ -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:
@@ -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,
View
4 r2/r2/lib/pages/pages.py
@@ -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
@@ -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]

0 comments on commit ab9ad7b

Please sign in to comment.