mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-05 03:00:15 -04:00
Add before/after support for Details.
This commit is contained in:
@@ -116,8 +116,11 @@ class FrontController(RedditController):
|
||||
@prevent_framing_and_css()
|
||||
@validate(VAdmin(),
|
||||
thing = VByName('article'),
|
||||
oldid36 = nop('article'))
|
||||
def GET_details(self, thing, oldid36):
|
||||
oldid36 = nop('article'),
|
||||
after=nop('after'),
|
||||
before=nop('before'),
|
||||
count=VCount('count'))
|
||||
def GET_details(self, thing, oldid36, after, before, count):
|
||||
"""The (now deprecated) details page. Content on this page
|
||||
has been subsubmed by the presence of the LinkInfoBar on the
|
||||
rightbox, so it is only useful for Admin-only wizardry."""
|
||||
@@ -128,7 +131,14 @@ class FrontController(RedditController):
|
||||
except (NotFound, ValueError):
|
||||
abort(404)
|
||||
|
||||
return DetailsPage(thing=thing, expand_children=False).render()
|
||||
kw = {'count': count}
|
||||
if before:
|
||||
kw['after'] = before
|
||||
kw['reverse'] = True
|
||||
else:
|
||||
kw['after'] = after
|
||||
kw['reverse'] = False
|
||||
return DetailsPage(thing=thing, expand_children=False, **kw).render()
|
||||
|
||||
def GET_selfserviceoatmeal(self):
|
||||
return BoringPage(_("self service help"),
|
||||
|
||||
@@ -32,8 +32,8 @@ class AdminSidebar(Templated):
|
||||
|
||||
|
||||
class Details(Templated):
|
||||
def __init__(self, link):
|
||||
Templated.__init__(self)
|
||||
def __init__(self, link, *a, **kw):
|
||||
Templated.__init__(self, *a, **kw)
|
||||
self.link = link
|
||||
|
||||
|
||||
|
||||
@@ -2914,11 +2914,17 @@ class DetailsPage(LinkInfoPage):
|
||||
|
||||
def __init__(self, thing, *args, **kwargs):
|
||||
from admin_pages import Details
|
||||
after = kwargs.pop('after', None)
|
||||
reverse = kwargs.pop('reverse', False)
|
||||
count = kwargs.pop('count', None)
|
||||
|
||||
if isinstance(thing, (Link, Comment)):
|
||||
details = Details(thing, after=after, reverse=reverse, count=count)
|
||||
|
||||
if isinstance(thing, Link):
|
||||
link = thing
|
||||
comment = None
|
||||
content = Details(thing=thing)
|
||||
content = details
|
||||
elif isinstance(thing, Comment):
|
||||
comment = thing
|
||||
link = Link._byID(comment.link_id)
|
||||
@@ -2927,7 +2933,7 @@ class DetailsPage(LinkInfoPage):
|
||||
content.append(LinkCommentSep())
|
||||
content.append(CommentPane(link, CommentSortMenu.operator('new'),
|
||||
comment, None, 1))
|
||||
content.append(Details(thing=thing))
|
||||
content.append(details)
|
||||
|
||||
kwargs['content'] = content
|
||||
LinkInfoPage.__init__(self, link, comment, *args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user