add liked/disliked style to midcol to fix score updates

This commit is contained in:
KeyserSosa
2009-06-02 16:29:31 -07:00
parent 416ee912f7
commit 09918f997e
11 changed files with 17 additions and 17 deletions

View File

@@ -216,7 +216,7 @@ $.fn.vote = function(vh, callback) {
/* let the user vote only if they are logged in */
if(reddit.logged) {
things.each(function() {
var entry = $(this).find(".entry:first");
var entry = $(this).find(".entry:first, .midcol:first");
if(dir > 0)
entry.addClass('likes').removeClass('dislikes');
else if(dir < 0)

View File

@@ -525,7 +525,7 @@ function updateEventHandlers(thing) {
.filter(":visible").trigger("onshow");
/* click on a title.. */
$(thing).find("a.title").mousedown(function() {
$(thing).find("a.title, a.comments").mousedown(function() {
/* the site is either stored in the sr dict, or we are on
* an sr and it is the current one */
var sr = reddit.sr[$(this).thing_id()] || reddit.cur_site;

View File

@@ -30,8 +30,8 @@
### specific fill-in functions for comment
##################
<%def name="midcol(display=True)">
${parent.midcol(not thing.collapsed)}
<%def name="midcol(display=True, cls = '')">
${parent.midcol(not thing.collapsed, cls = cls)}
</%def>
<%def name="ParentDiv()">

View File

@@ -23,9 +23,9 @@
<%inherit file="printable.html"/>
<%namespace file="utils.html" import="plain_link" />
<%def name="midcol(display=True)">
<%def name="midcol(display=True, cls = '')">
%if c.profilepage or (not thing._deleted and (not thing._spam or c.user == thing.author or c.user_is_admin)):
${parent.midcol(display=display)}
${parent.midcol(display=display, cls = cls)}
%endif
</%def>

View File

@@ -83,8 +83,8 @@
</script>
</%def>
<%def name="midcol(display=True)">
<div class="midcol" style="width:$midcolmargin;"
<%def name="midcol(display=True, cls = '')">
<div class="midcol ${cls}" style="width:$midcolmargin;"
${not display and "style='display:none'" or ''}>
${self.arrow(thing, 1, thing.likes)}
%if thing.hide_score:

View File

@@ -35,8 +35,8 @@
</span>
</%def>
<%def name="midcol(display=True)">
<div class="midcol" style="width:&midcolmargin;"
<%def name="midcol(display=True, cls = '')">
<div class="midcol ${cls}" style="width:&midcolmargin;"
${not display and "style='display:none'" or ''}>
${self.arrow(thing, 1, thing.likes)}
${self.arrow(thing, 0, thing.likes == False)}

View File

@@ -26,7 +26,7 @@
<%inherit file="comment_skeleton.html"/>
## disable voting arrows
<%def name="midcol()">
<%def name="midcol(cls='')">
</%def>

View File

@@ -50,6 +50,6 @@ load more comments <span class="gray">&nbsp;(${thing.count} ${ungettext("reply",
<%def name="tagline(collapse=False)">
</%def>
<%def name="midcol()">
<%def name="midcol(cls = '')">
</%def>

View File

@@ -41,6 +41,6 @@
<%def name="tagline(collapse=False)">
</%def>
<%def name="midcol()">
<%def name="midcol(cls='')">
</%def>

View File

@@ -77,7 +77,6 @@ thing id-${what._fullname}
${self.ParentDiv()}
</p>
${self.numcol()}
${self.midcol()}
<%
like_cls = "unvoted"
if getattr(thing, "likes", None):
@@ -85,6 +84,7 @@ thing id-${what._fullname}
elif getattr(thing, "likes", None) is False:
like_cls = "dislikes"
%>
${self.midcol(cls = like_cls)}
<div class="entry ${like_cls}">
${self.entry()}
</div>
@@ -218,8 +218,8 @@ thing id-${what._fullname}
</%def>
<%def name="midcol(display=True)">
<div class="midcol"
<%def name="midcol(display=True, cls = '')">
<div class="midcol ${cls}"
${not display and "style='display:none'" or ''}>
${self.arrow(thing, 1, thing.likes)}
${self.arrow(thing, 0, thing.likes == False)}

View File

@@ -98,7 +98,7 @@
</%def>
<%def name="midcol(display=True)">
<%def name="midcol(display=True, cls='')">
<div class="midcol">
${addremove_button(thing)}
${permission_icons(thing)}