Show user flair on .mobile

This commit is contained in:
Jonas Häggqvist
2011-08-27 18:21:40 +02:00
committed by Logan Hanks
parent e9c50e59b3
commit 447ef411c4
3 changed files with 27 additions and 0 deletions

View File

@@ -147,3 +147,4 @@ ul {
.md img { display: none }
.md ol, .md ul { margin: 10px 2em; }
.md pre { margin: 10px; }
.flair { color: #545454; background-color: #F5F5F5; border: 1px solid #DEDEDE; }

View File

@@ -23,6 +23,7 @@
<%!
from pylons.i18n import _, ungettext
from r2.lib.filters import safemarkdown
from r2.lib.pages import WrappedUser
%>
<%inherit file="printable.mobile" />
@@ -47,8 +48,22 @@
%else:
<p class="byline">
<%
author = thing.author
if WrappedUser(author).has_flair and WrappedUser(author).flair_enabled:
flair = WrappedUser(author).flair_text
flair_left = WrappedUser(author).flair_position == 'left'
else:
flair = False
%>
%if flair and flair_left:
<span class="flair">${flair}</span>
%endif
<a href="/user/${thing.author.name}">
<b>${thing.author.name}</b></a>
%if flair and not flair_left:
<span class="flair">${flair}</span>
%endif
&nbsp;|<span class="score">${thing.score} ${ungettext("point", "points", thing.score)} </span>
${_("written")} ${thing.timesince} ${_("ago")}
</p>

View File

@@ -59,8 +59,19 @@
name = websafe(author.name)
href = unsafe('href="/user/%s.mobile"' % name)
if c.user_is_admin: name += " (%d)" % (author.link_karma)
if WrappedUser(author).has_flair and WrappedUser(author).flair_enabled:
flair = WrappedUser(author).flair_text
flair_left = WrappedUser(author).flair_position == 'left'
else:
flair = False
%>
%if flair and flair_left:
<span class="flair">${flair}</span>
%endif
<a class="${author_cls}" ${href}>${name}</a>
%if flair and not flair_left:
<span class="flair">${flair}</span>
%endif
%endif
</%def>