Added more_karmas link, changed karmas sort order, plus some minor cleanup

This commit is contained in:
Mike
2009-05-11 14:29:08 -07:00
parent 88b1dd4338
commit 9c5dea3ae1
6 changed files with 36 additions and 32 deletions

View File

@@ -129,7 +129,8 @@ class Account(Thing):
karmas.append((sr_name,
self._t.get(sr_name + link_suffix, 0),
self._t.get(sr_name + comment_suffix, 0)))
karmas.sort(key = lambda x: x[1] + x[2])
karmas.sort(key = lambda x: abs(x[1] + x[2]), reverse=True)
karmas.insert(0, ('total',
self.karma('link'),

View File

@@ -654,15 +654,11 @@ before enabling */
font-size: small;
}
.menuarea {
border-bottom: 1px dotted gray;
padding: 5px 10px;
margin: 5px 310px 5px 5px;
font-size: larger;
.infobar img {
display: inline;
vertical-align: middle;
}
.menuarea .spacer {display: inline; margin-right: 15px}
/* markdown */
.md { max-width: 60em; overflow: auto; font-size: small; }
.md p, .md h1 { margin: 5px 0}
@@ -683,19 +679,6 @@ before enabling */
margin-right: 15px;
}
.infobar {
background-color: #f6e69f;
padding: 5px 10px;
margin: 5px 310px 5px 0px;
border: 1px solid orange;
font-size: small;
}
.infobar img {
display: inline;
vertical-align: middle;
}
.menuarea {
border-bottom: 1px dotted gray;
padding: 5px 10px;
@@ -763,7 +746,7 @@ a.star { text-decoration: none; color: #ff8b60 }
}
/* compressed links */
.linkcompressed { margin: 4px 0; overflow: hidden; margin-top: 5px; }
.linkcompressed { margin: 4px 0; overflow: hidden; margin-top: 6px; }
.linkcompressed .title {margin-bottom: 1px; font-size:medium; font-weight: normal;}
.linkcompressed .child h3 {
margin: 15px;
@@ -773,8 +756,8 @@ a.star { text-decoration: none; color: #ff8b60 }
.linkcompressed .score.likes { color: #FF8B60; }
.linkcompressed .score.dislikes { color: #9494FF; }
.linkcompressed .rank {
margin-top: 6px;
.linkcompressed .rank {
margin-top: 7px;
float:left;
color: #c6c6c6;
font-family: arial;
@@ -789,7 +772,7 @@ a.star { text-decoration: none; color: #ff8b60 }
.linkcompressed .entry .buttons li.first {padding-left: .5em;}
.linkcompressed .entry .buttons li a {
padding: 0 2px;
background-color: #f5f5f5;
background-color: #f6f6f6;
font-weight: bold
}
@@ -1001,6 +984,14 @@ textarea.gray { color: gray; }
.footer .col:first-child {border: none;}
.notes-button {
margin-top: 3px;
}
.notes-status {
font-size: larger;
}
.server-status { width: 300px; }
.server-status table {
font-size: xx-small;

View File

@@ -141,7 +141,7 @@ ${parent.midcol()}
%endif
%if c.user_is_loggedin and thing.author.name == c.user.name:
<li>
${parent.simple_button("edit", _("edit"), "editcomment")}
${parent.simple_button(_("edit"), "editcomment")}
</li>
%endif
%endif

View File

@@ -81,7 +81,7 @@ ${unsafe(safemarkdown(thing.body))}
${parent.buttons()}
%if c.user_is_loggedin:
<li>
${parent.simple_button("reply", _("reply {verb}"), "reply")}
${parent.simple_button(_("reply {verb}"), "reply")}
</li>
%endif
%endif

View File

@@ -285,7 +285,7 @@ thing id-${what._fullname}
</form>
</%def>
<%def name="simple_button(name, title, nameFunc)">
<%def name="simple_button(title, nameFunc)">
<a class="" href="javascript:void(0)"
onclick="return ${nameFunc}(this)">${title}</a>
</%def>

View File

@@ -38,12 +38,18 @@
%endif
<li>
<table>
<%
<%
karmas = thing.user.all_karmas()
##karmas.sort(lambda x,y: x[2] - y[2])
%>
%for label, lc, cc in karmas:
<tr style="text-align:right">
%for i, (label, lc, cc) in enumerate(karmas):
<tr
%if i < 5:
style="text-align:right"
%else:
class="more-karmas"
style="text-align:right; display: none"
%endif
>
<th>${label}:</th>
<td><b>${lc}</b></td>
<td>/</td>
@@ -51,6 +57,12 @@
</tr>
%endfor
</table>
%if i >= 5:
<a href="javascript:void(0)"
onclick="$('.more-karmas').show();$(this).hide();return false">
show karma for all ${len(karmas)} reddits
</a>
%endif
</li>
%else:
<li>