Logic for js-based targeting of links

This commit is contained in:
umbrae
2014-03-06 11:47:05 -05:00
parent f7de033bb2
commit ec5bb39648
4 changed files with 11 additions and 19 deletions

View File

@@ -227,13 +227,13 @@ def comment_label(num_comments=None):
if not num_comments:
# generates "comment" the imperative verb
com_label = _("comment {verb}")
com_cls = 'comments empty'
com_cls = 'comments empty may-blank'
else:
# generates "XX comments" as a noun
com_label = ungettext("comment", "comments", num_comments)
com_label = strings.number_label % dict(num=num_comments,
thing=com_label)
com_cls = 'comments'
com_cls = 'comments may-blank'
return com_label, com_cls
def replace_render(listing, item, render_func):

View File

@@ -42,7 +42,7 @@
</%def>
<%def name="make_link(name, css_class, tabindex=0)">
<a class="${css_class} ${ c.user_is_loggedin and 'loggedin' or ''}"
<a class="${css_class} may-blank ${ c.user_is_loggedin and 'loggedin' or ''}"
href="${thing.href_url}"
%if tabindex:
tabindex="${tabindex}"
@@ -50,9 +50,7 @@
%if thing.nofollow:
rel="nofollow"
%endif
%if thing.newwindow:
target="_blank"
%elif c.cname:
%if c.cname:
target="_top"
%endif
%if thing.mousedown_url:
@@ -173,8 +171,7 @@ ${parent.thing_data_attributes(what)} data-ups="${what.upvotes}" data-downs="${w
<%def name="subreddit()" buffered="True">
${plain_link(thing.subreddit.name, thing.subreddit_path, sr_path = False,
cname = False, _class = "subreddit hover",
target='_blank' if thing.newwindow else '')}
cname = False, _class = "subreddit hover may-blank")}
</%def>
<%def name="midcol(display=True, cls = '')">

View File

@@ -62,7 +62,7 @@
%if c.site.link_flair_position == 'left' and thing.flair_text:
${flair()}
%endif
<a class="reddit-link-title"
<a class="reddit-link-title may-blank"
${optionalstyle("text-decoration:none;color:#336699;font-size:small;")}
%if thing.is_self:
href="${permalink}"
@@ -74,8 +74,6 @@
%endif
%if c.link_target:
target="${c.link_target}"
%elif c.user.pref_newwindow:
target="_blank"
%elif c.cname:
target="_top"
%endif
@@ -113,7 +111,7 @@
</span>
&#32;|&#32;
%endif
<a class="reddit-comment-link"
<a class="reddit-comment-link may-blank"
${optionalstyle("color:gray")}
%if c.link_target:
target="${c.link_target}"

View File

@@ -179,8 +179,7 @@
<li class="first">
${self.comment_button("comment", thing.comment_label, thing.permalink,
_sr_path = (thing.promoted is None),
a_class = thing.commentcls,
newwindow = thing.new_window)}
a_class = thing.commentcls)}
</li>
%endif
%if thing.editable:
@@ -290,8 +289,7 @@
_("full comments") + " (%d)" % thing.full_comment_count,
thing.full_comment_path,
_sr_path = True,
a_class = None,
newwindow = thing.new_window)}
a_class = "may-blank")}
</li>
%endif
%if not thing.profilepage:
@@ -490,11 +488,10 @@
### originally in commentbutton
<%def name="comment_button(name, link_text, link,\
_sr_path = True, a_class='', title='', newwindow = False)">
_sr_path = True, a_class='', title='')">
${plain_link(link_text, link,
_sr_path = _sr_path,
_class=a_class, title=title,
target='_blank' if newwindow else '_parent')}
_class=a_class, title=title)}
</%def>
<%def name="bylink_button(title, link)">