add custom firsttext for iphones, linking out to free reddit app

This commit is contained in:
KeyserSosa
2009-07-13 13:55:07 -07:00
parent c70106fdc8
commit 54faeb8aac
3 changed files with 11 additions and 3 deletions

View File

@@ -169,7 +169,11 @@ def read_mod_cookie():
set_user_cookie('mod', '')
def firsttime():
if get_redditfirst('firsttime'):
if (request.user_agent and 'iphone' in request.user_agent.lower() and
not get_redditfirst('iphone')):
set_redditfirst('iphone','first')
return 'iphone'
elif get_redditfirst('firsttime'):
return False
else:
set_redditfirst('firsttime','first')

View File

@@ -107,8 +107,11 @@ class Reddit(Templated):
#add the infobar
self.infobar = None
if self.show_firsttext and c.firsttime and c.site.firsttext and not infotext:
infotext = c.site.firsttext
if self.show_firsttext and not infotext:
if c.firsttime == 'iphone':
infotext = strings.iphone_first
elif c.firsttime and c.site.firsttext:
infotext = c.site.firsttext
if infotext:
self.infobar = InfoBar(message = infotext)

View File

@@ -124,6 +124,7 @@ string_dict = dict(
submit_link = _("""You are submitting a link. The key to a successful submission is interesting content and a descriptive title."""),
submit_text = _("""You are submitting a text-based post. Speak your mind. A title is required, but expanding further in the text field is not. Beginning your title with "vote up if" is violation of intergalactic law."""),
iphone_first = _("You should consider using [reddit's free iphone app](http://itunes.com/apps/iredditfree)."),
)
class StringHandler(object):