From ec5bb39648bc1ff8cd6829a9282efc6d931bb0af Mon Sep 17 00:00:00 2001 From: umbrae Date: Thu, 6 Mar 2014 11:47:05 -0500 Subject: [PATCH] Logic for js-based targeting of links --- r2/r2/lib/template_helpers.py | 4 ++-- r2/r2/templates/link.html | 9 +++------ r2/r2/templates/link.htmllite | 6 ++---- r2/r2/templates/printablebuttons.html | 11 ++++------- 4 files changed, 11 insertions(+), 19 deletions(-) diff --git a/r2/r2/lib/template_helpers.py b/r2/r2/lib/template_helpers.py index b781525ec..ae114d498 100755 --- a/r2/r2/lib/template_helpers.py +++ b/r2/r2/lib/template_helpers.py @@ -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): diff --git a/r2/r2/templates/link.html b/r2/r2/templates/link.html index 6dd657f80..719744730 100755 --- a/r2/r2/templates/link.html +++ b/r2/r2/templates/link.html @@ -42,7 +42,7 @@ <%def name="make_link(name, css_class, tabindex=0)"> - ${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 name="midcol(display=True, cls = '')"> diff --git a/r2/r2/templates/link.htmllite b/r2/r2/templates/link.htmllite index 9223386db..61e899cca 100644 --- a/r2/r2/templates/link.htmllite +++ b/r2/r2/templates/link.htmllite @@ -62,7 +62,7 @@ %if c.site.link_flair_position == 'left' and thing.flair_text: ${flair()} %endif - | %endif - ${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)} %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")} %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 name="bylink_button(title, link)">