From 7c9d9742d5c0c478af4b0bd20a428a99becbb207 Mon Sep 17 00:00:00 2001 From: Max Goodman Date: Fri, 20 Sep 2013 16:48:11 -0700 Subject: [PATCH] compressed links: Add class non-destructively. For compressed links mode, augment the render class instead of replacing it. This fixes an issue where compressed promoted links in self serve listings didn't get the "promoted" class. --- r2/r2/models/link.py | 2 +- r2/r2/templates/printable.html | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/r2/r2/models/link.py b/r2/r2/models/link.py index ef9a59c7e..b31f6e775 100755 --- a/r2/r2/models/link.py +++ b/r2/r2/models/link.py @@ -394,7 +394,7 @@ class Link(Thing, Printable): item.score_fmt = Score.points item.pref_compress = user.pref_compress if user.pref_compress: - item.render_css_class = "compressed link" + item.extra_css_class = "compressed" item.score_fmt = Score.points elif pref_media == 'on' and not user.pref_compress: show_media = True diff --git a/r2/r2/templates/printable.html b/r2/r2/templates/printable.html index 1cd6cd815..280f2cb0c 100644 --- a/r2/r2/templates/printable.html +++ b/r2/r2/templates/printable.html @@ -106,7 +106,9 @@ ${self.RenderPrintable()} cls = thing.render_class.__name__.lower() else: cls = thing.lookups[0].__class__.__name__.lower() - + + cls += ' ' + getattr(thing, 'extra_css_class', '') + if getattr(thing, "is_self", False): selflink = "self" else: