Add details page for comments.

This commit is contained in:
Max Goodman
2011-08-24 20:18:36 -07:00
committed by Neil Williams
parent 097ccb66a9
commit c15ff9fa86
5 changed files with 30 additions and 11 deletions

View File

@@ -113,13 +113,12 @@ class FrontController(RedditController):
@prevent_framing_and_css()
@validate(VAdmin(),
article = VLink('article'))
def GET_details(self, article):
"""The (now depricated) details page. Content on this page
thing = VByName('article'))
def GET_details(self, thing):
"""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."""
return DetailsPage(link = article, expand_children=False).render()
return DetailsPage(thing=thing, expand_children=False).render()
def GET_selfserviceoatmeal(self):
return BoringPage(_("self service help"),

View File

@@ -30,6 +30,7 @@ from r2.models.oauth2 import OAuth2Client
from r2.models import ModAction
from r2.models import Thing
from r2.config import cache
from r2.lib.menus import CommentSortMenu
from r2.lib.tracking import AdframeInfo
from r2.lib.jsonresponse import json_respond
from r2.lib.jsontemplates import is_api
@@ -951,7 +952,7 @@ class LinkInfoPage(Reddit):
num = len(self.duplicates)))
if c.user_is_admin:
buttons += [info_button('details')]
buttons.append(NamedButton("details", dest="/details/"+self.link._fullname))
# should we show a traffic tab (promoted and author or sponsor)
if (self.link.promoted is not None and
@@ -2914,10 +2915,25 @@ class TrafficViewerList(UserList):
class DetailsPage(LinkInfoPage):
extension_handling= False
def content(self):
# TODO: a better way?
def __init__(self, thing, *args, **kwargs):
from admin_pages import Details
return self.content_stack((self.link_listing, Details(link = self.link)))
if isinstance(thing, Link):
link = thing
comment = None
content = Details(thing=thing)
elif isinstance(thing, Comment):
comment = thing
link = Link._byID(comment.link_id)
content = PaneStack()
content.append(PermalinkMessage(link.make_permalink_slow()))
content.append(LinkCommentSep())
content.append(CommentPane(link, CommentSortMenu.operator('new'),
comment, None, 1))
content.append(Details(thing=thing))
kwargs['content'] = content
LinkInfoPage.__init__(self, link, comment, *args, **kwargs)
class Cnameframe(Templated):
"""The frame page."""

View File

@@ -1221,7 +1221,7 @@ a.star { text-decoration: none; color: #ff8b60 }
/* comments */
.comment { margin-left: 10px; }
.comment, .content .details { margin-left: 10px; }
.comment .edit-body { display: none; visibility: hidden; }
.comment .midcol { margin-left: 0px; }
.comment .title { font-size: small; margin-top: 10px;}

View File

@@ -239,7 +239,6 @@ ${parent.thing_data_attributes(what)} data-ups="${what.upvotes}" data-downs="${w
score = capture(self.score, thing, thing.likes, tag='span'),
when = capture(thing_timestamp, thing, thing.timesince),
author = WrappedUser(thing.author, thing.attribs, thing).render()))}
</%def>
<%def name="child()">

View File

@@ -92,3 +92,8 @@
%if thing.ip_span:
${unsafe(thing.ip_span)}
%endif
%if c.user_is_admin and thing.context_thing:
&#32;
<a class="adminbox" href="/details/${thing.context_thing._fullname}">i</a>
%endif