From d9e398a7fe571727660dcdf347fa35a056e8318c Mon Sep 17 00:00:00 2001 From: spez Date: Fri, 24 Oct 2008 14:59:04 -0700 Subject: [PATCH] added a /comments and fixed an independent.co.uk button bug --- r2/r2/config/routing.py | 4 ++-- r2/r2/controllers/__init__.py | 1 + r2/r2/controllers/listingcontroller.py | 6 ++++++ r2/r2/templates/buttontypes.html | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/r2/r2/config/routing.py b/r2/r2/config/routing.py index 0fce3220a..3441089c7 100644 --- a/r2/r2/config/routing.py +++ b/r2/r2/config/routing.py @@ -89,7 +89,7 @@ def make_map(global_conf={}, app_conf={}): action='oldinfo', dest='comments', type='ancient') mc('/info/:article/:dest/:comment', controller='front', action='oldinfo', type='old', dest='comments', comment=None) - + mc('/related/:article/:title', controller='front', action = 'related', title=None) mc('/details/:article/:title', controller='front', @@ -104,7 +104,7 @@ def make_map(global_conf={}, app_conf={}): mc('/', controller='hot', action='listing') - listing_controllers = "hot|saved|toplinks|new|recommended|randomrising" + listing_controllers = "hot|saved|toplinks|new|recommended|randomrising|comments" mc('/:controller', action='listing', requirements=dict(controller=listing_controllers)) diff --git a/r2/r2/controllers/__init__.py b/r2/r2/controllers/__init__.py index 388ca8fad..dcc31e33c 100644 --- a/r2/r2/controllers/__init__.py +++ b/r2/r2/controllers/__init__.py @@ -32,6 +32,7 @@ from listingcontroller import MyredditsController from listingcontroller import ByIDController as ByidController from listingcontroller import RandomrisingController from listingcontroller import UserController +from listingcontroller import CommentsController from feedback import FeedbackController from front import FrontController diff --git a/r2/r2/controllers/listingcontroller.py b/r2/r2/controllers/listingcontroller.py index e3f274531..b3551a8c2 100644 --- a/r2/r2/controllers/listingcontroller.py +++ b/r2/r2/controllers/listingcontroller.py @@ -562,3 +562,9 @@ class MyredditsController(ListingController): def GET_listing(self, where, **env): self.where = where return ListingController.GET_listing(self, **env) + +class CommentsController(ListingController): + title_text = _('comments') + + def query(self): + return Comment._query(sort = desc('_date')) diff --git a/r2/r2/templates/buttontypes.html b/r2/r2/templates/buttontypes.html index 9afe1e4dd..7ca42544b 100644 --- a/r2/r2/templates/buttontypes.html +++ b/r2/r2/templates/buttontypes.html @@ -146,7 +146,7 @@ ${class_def(3)} fullname = thing.link._fullname ups = thing.link.upvotes downs = thing.link.downvotes - link = "http://%s%s" % (get_domain(cname = c.cname, subreddit = not c.cname), + link = "http://%s%s" % (get_domain(cname = c.cname, subreddit = False), thing.link.make_permalink_slow()) else: fullname = ""