mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 08:17:58 -05:00
added links to domains and fixed comment JSON feed to include link_id and parent_id
This commit is contained in:
@@ -160,7 +160,21 @@ class CommentJsonTemplate(ThingJsonTemplate):
|
||||
body = "body",
|
||||
likes = "likes",
|
||||
author = "author",
|
||||
created = "created")
|
||||
created = "created",
|
||||
link_id = "link_id",
|
||||
parent_id = "parent_id",
|
||||
)
|
||||
|
||||
def thing_attr(self, thing, attr):
|
||||
from r2.models import Comment, Link
|
||||
if attr == 'link_id':
|
||||
return make_fullname(Link, thing.link_id)
|
||||
elif attr == "parent_id":
|
||||
try:
|
||||
return make_fullname(Comment, thing.parent_id)
|
||||
except AttributeError:
|
||||
return make_fullname(Link, thing.link_id)
|
||||
return ThingJsonTemplate.thing_attr(self, thing, attr)
|
||||
|
||||
def kind(self, wrapped):
|
||||
from r2.models import Comment
|
||||
|
||||
@@ -489,7 +489,7 @@ before enabling */
|
||||
opacity: 1;
|
||||
}
|
||||
.domain { color: #888; font-size:x-small; }
|
||||
.domain a { color: #336699 }
|
||||
.domain a { color: #888 }
|
||||
.domain a:hover { text-decoration: underline }
|
||||
|
||||
.tagline { color:#888; font-size:x-small;
|
||||
|
||||
@@ -72,7 +72,7 @@
|
||||
${thing.title}
|
||||
</%call>
|
||||
 
|
||||
${unsafe(self.domain())}
|
||||
${self.domain()}
|
||||
</p>
|
||||
<p class="tagline">
|
||||
${self.tagline()}
|
||||
@@ -138,7 +138,7 @@
|
||||
|
||||
<%def name="domain()">
|
||||
<span class="domain">
|
||||
(${thing.domain})
|
||||
(<a href="/domain/${thing.domain}">${thing.domain}</a>)
|
||||
</span>
|
||||
</%def>
|
||||
|
||||
|
||||
@@ -24,19 +24,14 @@
|
||||
|
||||
<%inherit file="link.html"/>
|
||||
|
||||
<%def name="domain()" buffered="True">
|
||||
<%def name="domain()">
|
||||
<span class="domain">
|
||||
<% from r2.models import FakeSubreddit, Default %>
|
||||
%if isinstance(c.site, FakeSubreddit) and thing.subreddit.name != "reddit.com":
|
||||
[${unsafe(self.subreddit())}]
|
||||
%endif
|
||||
 
|
||||
%if c.user_is_admin:
|
||||
(<a href="/admin/info?domain=${thing.domain}">${thing.domain}</a>)
|
||||
%else:
|
||||
(${thing.domain})
|
||||
%endif
|
||||
|
||||
(<a href="/domain/${thing.domain}">${thing.domain}</a>)
|
||||
</span>
|
||||
</%def>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user