updates to API: about.json on user pages to fetch link and comment karma without scraping html; added link_title attribute to comments in places where they render in html with their link's title (profile page).

updates to iphone page.
This commit is contained in:
KeyserSosa
2009-07-21 16:47:15 -07:00
parent 2cf3490329
commit b9ec9f62cf
8 changed files with 100 additions and 36 deletions

View File

@@ -82,6 +82,8 @@ def make_map(global_conf={}, app_conf={}):
mc('/admin/:action', controller='admin')
mc('/user/:username/about', controller='user', action='about',
where='overview')
mc('/user/:username/:where', controller='user', action='listing',
where='overview')

View File

@@ -42,6 +42,7 @@ api('reddit', RedditJsonTemplate)
api('panestack', PanestackJsonTemplate)
api('listing', ListingJsonTemplate)
api('usertableitem', UserItemJsonTemplate)
api('account', AccountJsonTemplate)
api('organiclisting', OrganicListingJsonTemplate)
api('reddittraffic', TrafficJsonTemplate)

View File

@@ -34,6 +34,7 @@ from r2.lib.db.thing import Query, Merge, Relations
from r2.lib.db import queries
from r2.lib.strings import Score
from r2.lib import organic
from r2.lib.jsontemplates import is_api
from r2.lib.solrsearch import SearchQuery
from r2.lib.utils import iters, check_cheating, timeago
from r2.lib import sup
@@ -453,6 +454,11 @@ class UserController(ListingController):
return ListingController.GET_listing(self, **env)
@validate(vuser = VExistingUname('username'))
def GET_about(self, vuser):
if not is_api() or not vuser:
return self.abort404()
return Reddit(content = Wrapped(vuser)).render()
class MessageController(ListingController):
show_sidebar = False

View File

@@ -185,6 +185,11 @@ class SubredditJsonTemplate(ThingJsonTemplate):
over18 = "over_18",
description = "description")
class AccountJsonTemplate(ThingJsonTemplate):
_data_attrs_ = ThingJsonTemplate.data_attrs(name = "name",
link_karma = "safe_karma",
comment_karma = "comment_karma")
class LinkJsonTemplate(ThingJsonTemplate):
_data_attrs_ = ThingJsonTemplate.data_attrs(ups = "upvotes",
downs = "downvotes",
@@ -249,6 +254,12 @@ class CommentJsonTemplate(ThingJsonTemplate):
from r2.models import Comment
return make_typename(Comment)
def raw_data(self, thing):
d = ThingJsonTemplate.raw_data(self, thing)
if c.profilepage:
d['link_title'] = thing.link.title
return d
def rendered_data(self, wrapped):
d = ThingJsonTemplate.rendered_data(self, wrapped)
d['replies'] = self.thing_attr(wrapped, 'child')

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@@ -1,5 +1,6 @@
<html>
<head>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<style>
body {
background-color:#F5F6F7;
@@ -41,7 +42,7 @@ h1 {
h2 {
color:#111;
font-weight:bold;
font-size: 1.2em;
font-size: 1.4em;
}
@@ -141,18 +142,16 @@ h2 {
}
</style>
<script src='random.js' language='javascript' type='text/javascript' />
<script src="random.js" language="javascript" type="text/javascript">
</script>
</head>
<body>
<div id="nav"><span style="font-weight:bold; color:white">&raquo;</span>&nbsp;<a href="http://reddit.com">back to reddit.com</a>&nbsp;&nbsp;<span style="font-weight:bold; color:white;">|</span>&nbsp;&nbsp;<a href="http://getsatisfaction.com/reddit/products/reddit_ireddit">give us feedback</a>&nbsp;&nbsp;<span style="font-weight:bold; color:white;">|</span>&nbsp;&nbsp;<a href="#buzz">bask in the buzz</a>&nbsp;&nbsp;<span style="font-weight:bold; color:white;">|</span>&nbsp;&nbsp;<a href="http://apple.reddit.com">visit apple.reddit</a>&nbsp;&nbsp;<span style="font-weight:bold; color:white;">|</span>&nbsp;&nbsp;<span><a href="http://justin.tv/reddit">say hi to mrs. splashy pants</a></span></div>
</head><body>
<div id="nav"><span style="font-weight: bold; color: white;">»</span>&nbsp;<a href="http://reddit.com/">back to reddit.com</a>&nbsp;&nbsp;<span style="font-weight: bold; color: white;">|</span>&nbsp;&nbsp;<a href="http://getsatisfaction.com/reddit/products/reddit_ireddit">give us feedback</a>&nbsp;&nbsp;<span style="font-weight: bold; color: white;">|</span>&nbsp;&nbsp;<a href="#buzz">bask in the buzz</a>&nbsp;&nbsp;<span style="font-weight: bold; color: white;">|</span>&nbsp;&nbsp;<a href="http://apple.reddit.com/">visit apple.reddit</a>&nbsp;&nbsp;<span style="font-weight: bold; color: white;">|</span>&nbsp;&nbsp;<span><a href="http://reddit.com/store">wear your reddit pride</a></span></div>
<div id="main">
<div id="right">
<table cellspacing="0" cellpadding="0">
<tr>
<table cellpadding="0" cellspacing="0">
<tbody><tr>
<td colspan="3" height="107px" width="304px">
<img src="iPhone-top.png">
</td>
@@ -160,7 +159,7 @@ h2 {
<tr>
<td height="360px" width="32px"><img src="iPhone-left.png"></td>
<td><embed src="http://s3.amazonaws.com/iReddit/iPhoneSim.mov" height="360px" width="240px" autoplay="true" controller="false"></td>
<td><embed src="http://s3.amazonaws.com/iReddit/iPhoneSim.mov" autoplay="true" controller="false" height="360px" width="240px"></td>
<td height="360px" width="32px"><img src="iPhone-right.png"></td>
</tr>
@@ -169,7 +168,7 @@ h2 {
<img src="iPhone-bottom.png">
</td>
</tr>
</table>
</tbody></table>
</div>
@@ -183,24 +182,31 @@ h2 {
The best of the web is in your hand.<br>
And you can even shake it
<br>
<span style="line-height: 1.8em; font-size:.5em;">
<script lanugage="JavaScript">document.write(quote);</script>
<span style="line-height: 1.8em; font-size: 0.5em;">
<script lanugage="JavaScript">document.write(quote);</script>
</span>
<br>
for a random, cool link.
</p>
<a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=302732279&mt=8"><img border="0" src="getapp.png"></a>
<div style="margin-bottom: 40px;">
<a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=302732279&amp;mt=8"><img style="float:left; margin-right: 10px;margin-bottom: 10px;" src="iReddit-thumb.png"></a>
<p>
Buy the iReddit app for $1.99 and you'll never see an ad on it.
<br>
If you're more patient, we'll be releasing an ad-supported free version in the future.
Buy the iReddit app for just $.99 and you'll never see an ad on it. It comes with a ton of sound effects for your shaking pleasure and will let you aggregate up to 500 reddit subscriptions.
</p>
<a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=302732279&amp;mt=8"><img src="getapp.png" border="0"></a>
</div>
<div><a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=321405188&mt=8"><img style="float:left; margin-right: 10px;margin-bottom: 10px;" src="iRedditFree-thumb.png"></a>
<p>
Feeling hesitant? Try the free version of iReddit. You just get one sound effect, though it is cool, and you can aggregate only 100 of your reddit subscriptions.
</p>
<a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=321405188&mt=8"><img src="getapp.png" border="0"></a>
</div>
<div style="float: left; margin-top: 13px; margin-bottom: 33px;">
<h2 style="font-size: .7em;">not convinced? watch the commercial</h2>
<div style="width: 425px; height: 264px; border: 1px solid #EEE; padding: 3px;">
<h2 style="font-size: 0.7em;">not convinced? watch the commercial</h2>
<div style="border: 1px solid rgb(238, 238, 238); padding: 3px; width: 425px; height: 264px;">
<object width="425" height="264"><param name="movie" value="http://www.youtube.com/v/jjxlEodOETU&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/jjxlEodOETU&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="264"></embed></object>
</div>
</div>
@@ -213,7 +219,7 @@ If you're more patient, we'll be releasing an ad-supported free version in the f
<div id="bottom">
<div>
<h2>the feature list</h2>
<ul style="color:#202020;">
<ul style="color: rgb(32, 32, 32);">
<li>all the reddit sort options; view links by hotness, newness, top-score-ness, and controversy</li>
<li>baked-in browser means you can vote without leaving the page and easily jump to comments or move up/down the listings</li>
<li>commenting has never been easier, or sexier, on a mobile device</li>
@@ -223,6 +229,11 @@ If you're more patient, we'll be releasing an ad-supported free version in the f
<li>alien loading animation improves load time by 500% (that is, makes the waiting suck 5x less)</li>
<li><b>pro-tip:</b> enable sounds in preferences and savor the awe of your peers</li>
</ul>
<i><a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=302732279&amp;mt=8">full-version</a> only:</i>
<ul style="color: rgb(32, 32, 32);">
<li>7 different awesome sounds to choose from</li>
<li>aggregates up to 500 of your subscribed reddits (free version maxes out at 100)</li>
</ul>
</div>
<div style="margin-top: 23px;">
@@ -230,21 +241,38 @@ If you're more patient, we'll be releasing an ad-supported free version in the f
<div id="quotebubble">
<p id="quote">
While in Serendipity mode, you will keep getting fed random stories to view/vote on every time you hit the "Hit me" button or shake the iPhone. Clicking "No More!!!" will take you back to regular mode. Much like UrbanSpoon, <span id="highlight">I could see this Serendipity mode becoming addicting</span>. It's a bit like a completely random StumbleUpon (a website discovery tool), but again, using the iPhone's accelerometer.
<span id="highlight">I have been captivated by the updated iReddit</span>. It's so much better than prev versions.
</p>
<p id="quoted">
&#8594;&nbsp;<a href="http://twitter.com/simonpickles/statuses/2604281023">@simonpickles</a>, on Twitter
</p>
</div>
<div id="quotebubble">
<p id="quote">
While in Serendipity mode, you will keep getting fed random stories to
view/vote on every time you hit the "Hit me" button or shake the
iPhone. Clicking "No More!!!" will take you back to regular mode. Much
like UrbanSpoon, <span id="highlight">I could see this Serendipity mode becoming addicting</span>. It's a bit like a completely random StumbleUpon (a website discovery tool), but again, using the iPhone's accelerometer.
</p>
<p id="quote">
<span id="highlight">Such a feature seems perfect for a social voting site</span>, where users are often looking for new and interesting stories.
</p>
<p id="quoted">
&rarr;&nbsp;<a href="http://venturebeat.com/2009/01/20/preview-reddit-strikes-back-with-its-official-iphone-app/">VentureBeat</a>
&#8594;&nbsp;<a href="http://venturebeat.com/2009/01/20/preview-reddit-strikes-back-with-its-official-iphone-app/">VentureBeat</a>
</p>
</div>
<div id="quotebubble">
<p id="quote">
Not only does iReddit <span id="highlight">has all your favorite Reddit functionality</span>: view stories, vote, comment, share, explore different subreddits, and save links for later, it also lets you 'shake' to get a new story; an idea, Ohanian says, that has been "floating around ever since I saw the Urbanspoon app."</p>
Not only does iReddit <span id="highlight">has all your favorite Reddit functionality</span>:
view stories, vote, comment, share, explore different subreddits, and
save links for later, it also lets you 'shake' to get a new story; an
idea, Ohanian says, that has been "floating around ever since I saw the
Urbanspoon app."</p>
<p id="quoted">
&rarr;&nbsp;<a href="http://www.readwriteweb.com/archives/the_official_reddit_iphone_app.php">ReadWriteWeb</a>
&#8594;&nbsp;<a href="http://www.readwriteweb.com/archives/the_official_reddit_iphone_app.php">ReadWriteWeb</a>
</p>
</div>
@@ -254,7 +282,7 @@ Not only does iReddit <span id="highlight">has all your favorite Reddit function
$1.99? <span id="highlight">I've spent more on worse</span> on the iPhone. Sold.
</p>
<p id="quoted">
&rarr;&nbsp;<a href="http://news.ycombinator.com/user?id=bvttf">bvttf</a>, on <a href="http://news.ycombinator.com/item?id=481677">HackerNews</a>
&#8594;&nbsp;<a href="http://news.ycombinator.com/user?id=bvttf">bvttf</a>, on <a href="http://news.ycombinator.com/item?id=481677">HackerNews</a>
</p>
</div>
@@ -263,42 +291,54 @@ $1.99? <span id="highlight">I've spent more on worse</span> on the iPhone. Sold.
iphone reddit app. <span id="highlight">life = over.</span>
</p>
<p id="quoted">
&rarr;&nbsp;<a href="http://twitter.com/seeandyspin/">seeandyspin</a>, on <a href="http://twitter.com/seeandyspin/status/1217347350">twitter</a>
&#8594;&nbsp;<a href="http://twitter.com/seeandyspin/status/1217347350">@seeandyspin</a>, on twitter</a>
</p>
</div>
<div id="quotebubble">
<p id="quote">
<span id="highlight">A particularly interesting feature is the Serendipity mode</span>, which lets you you browse random Reddit stories without clicking; simply shake the iPhone and you'll be served a brand new link.</p>
iphone reddit app. <span id="highlight">life = over.</span>
</p>
<p id="quoted">
&rarr;&nbsp;<a href="http://mashable.com/2009/02/17/reddit-iphone/">Mashable</a>
&#8594;&nbsp;<a href="http://twitter.com/seeandyspin/status/1217347350">@seeandyspin</a>, on twitter</a>
</p>
</div>
<div id="quotebubble">
<p id="quote">
<span id="highlight">A particularly interesting feature is the Serendipity mode</span>,
which lets you you browse random Reddit stories without clicking;
simply shake the iPhone and you'll be served a brand new link.</p>
<p id="quoted">
&#8594;&nbsp;<a href="http://mashable.com/2009/02/17/reddit-iphone/">Mashable</a>
</p>
</div>
</div>
<a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=302732279&mt=8"><img border="0" src="getapp.png"></a>
<div style="text-align:center"><a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=302732279&amp;mt=8">iReddit on the AppStore</a>&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=321405188&mt=8">iReddit Free on the AppStore</a></div>
</div>
</div>
<!--just ended bottom-->
</div>
<!--just ended main-->
<div id="footer">reddit <3s you</div>
<div id="footer">reddit &lt;3s you</div>
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
</script><script src="ga.js" type="text/javascript"></script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-1237041-22");
pageTracker._trackPageview();
} catch(err) {}</script>
</body>
</html>
</body></html>

View File

@@ -5,6 +5,10 @@ quoteList[5] = "(like a mystery present)";
quoteList[2] = "(like a salt shaker)";
quoteList[3] = "(like a pom pom)";
quoteList[4] = "(like a British nanny)";
quoteList[5] = "(like a mystery present)";
quoteList[6] = "(like a monkey with a puzzle)";
quoteList[7] = "(like a tiny Etch-A-Sketch)";
quoteList[8] = "(like a British nanny)";
quoteList[9] = "(with gusto!)";
quoteList[10] = "(like you're trying to get the last crumbs from the Doritos bag)";
quoteList[11] = "(instead of going to the gym)";