Add data attributes for ups and downs on links and comments.

This commit is contained in:
Neil Williams
2012-03-28 08:01:16 -07:00
parent 83edb3bb0d
commit 9d69c78b36
3 changed files with 12 additions and 1 deletions

View File

@@ -33,6 +33,10 @@
### specific fill-in functions for comment
##################
<%def name="thing_data_attributes(what)" buffered="True">
${parent.thing_data_attributes(what)} data-ups="${what.upvotes}" data-downs="${what.downvotes}"
</%def>
<%def name="midcol(display=True, cls = '')">
${parent.midcol(not thing.collapsed, cls = cls)}
</%def>

View File

@@ -156,6 +156,10 @@
${parent.thing_css_class(what)} ${"over18" if thing.over_18 else ""}
</%def>
<%def name="thing_data_attributes(what)" buffered="True">
${parent.thing_data_attributes(what)} data-ups="${what.upvotes}" data-downs="${what.downvotes}"
</%def>
<%def name="subreddit()" buffered="True">
${plain_link(thing.subreddit.name, thing.subreddit_path, sr_path = False,
cname = False, _class = "subreddit hover",

View File

@@ -47,6 +47,8 @@ ${self.RenderPrintable()}
<%def name="thing_css_class(what)">thing id-${what._fullname}</%def>
<%def name="thing_data_attributes(what)">data-fullname="${what._fullname}"</%def>
<%def name="RenderPrintable()">
<% cls = thing.lookups[0].__class__.__name__.lower() %>
<%
@@ -76,7 +78,8 @@ ${self.RenderPrintable()}
rowclass += " hidden"
%>
<div class="${self.thing_css_class(thing)} ${rowclass} ${unsafe(cls)} ${selflink}"
${thing.display} data-fullname="${thing._fullname}" onclick="click_thing(this)">
${thing.display} onclick="click_thing(this)"
${unsafe(self.thing_data_attributes(thing))}>
<p class="parent">
${self.ParentDiv()}
</p>