diff --git a/r2/r2/controllers/listingcontroller.py b/r2/r2/controllers/listingcontroller.py index a8adba1d6..ebe028eee 100644 --- a/r2/r2/controllers/listingcontroller.py +++ b/r2/r2/controllers/listingcontroller.py @@ -158,10 +158,6 @@ class ListingController(RedditController): w.render_class = PromotedLink w.rowstyle = 'promoted link' - elif c.user.pref_compress: - w.render_class = LinkCompressed - w.score_fmt = Score.points - return w def GET_listing(self, **env): diff --git a/r2/r2/models/link.py b/r2/r2/models/link.py index 865ac5135..7d7f50890 100644 --- a/r2/r2/models/link.py +++ b/r2/r2/models/link.py @@ -420,17 +420,6 @@ class PromotedLink(Link): # keep the template from trying to read it item.promoted_by = None -class LinkCompressed(Link): - _nodb = True - - @classmethod - def add_props(cls, user, wrapped): - Link.add_props(user, wrapped) - - for item in wrapped: - item.score_fmt = Score.points - - class Comment(Thing, Printable): _data_int_props = Thing._data_int_props + ('reported',) _defaults = dict(reported = 0, diff --git a/r2/r2/public/static/css/reddit.css b/r2/r2/public/static/css/reddit.css index b9f2caa05..661d7317e 100644 --- a/r2/r2/public/static/css/reddit.css +++ b/r2/r2/public/static/css/reddit.css @@ -493,10 +493,6 @@ before enabling */ color: #336699; } -.linkcompressed .media-button .option.active { - padding-right: 15px; -} - .embededmedia { margin-top: 5px; margin-left: 60px; } .thing .title { color: blue; padding: 0px; overflow: hidden; } @@ -557,12 +553,6 @@ before enabling */ margin-bottom: 0px; } -.organic-listing .linkcompressed { - background-color: #F8F8F8; - padding: 5px 7em 10px 0; - margin-bottom: 0px; - } - .organic-listing .nextprev { margin: 0px; position: absolute; @@ -733,6 +723,12 @@ a.star { text-decoration: none; color: #ff8b60 } text-align: right; } +.compressed { margin-bottom: 5px; } +.compressed .rank { margin-top: 10px; } +.compressed .title { margin: -2px 0 } +.compressed .score { color: #888888 } +.compressed .score-placeholder { height: 3px } + /* display the right score based on whether they've voted */ .score.likes, .score.dislikes {display: none;} .likes .score, .dislikes .score {display: none;} @@ -741,45 +737,6 @@ a.star { text-decoration: none; color: #ff8b60 } .likes div.score.likes {display: block;} .dislikes div.score.dislikes {display: block;} -/* compressed links */ -.linkcompressed { margin: 4px 0; overflow: hidden; margin-top: 9px; } -.linkcompressed .title {margin-bottom: 5px; font-size:medium; font-weight: normal;} -.linkcompressed .child h3 { - margin: 15px; - text-transform: none; - font-size: medium; -} - -.linkcompressed .score.likes { color: #FF8B60; } -.linkcompressed .score.dislikes { color: #9494FF; } -.linkcompressed .rank { - margin-top: 9px; - float:left; - color: #c6c6c6; - font-family: arial; - font-size: medium; - text-align: right; -} -.linkcompressed .arrow.down, .linkcompressed .arrow.downmod { - margin-top: 5px; -} - -.linkcompressed .tagline { display: inline; margin-top: 0px; margin-bottom: 1px; } -.linkcompressed .flat-list { display: inline } - -/* compressed buttons */ -.linkcompressed .entry .buttons li { padding: 2px; background-color: transparent; } -.linkcompressed .entry .buttons li.first {padding-left: .5em;} -.linkcompressed .entry .buttons li a { - padding: 0 2px; - background-color: #fdfdfd; - font-weight: bold -} - -.linkcompressed .midcol { width: 15px; } -.linkcompressed .entry .buttons li a:hover { text-decoration: underline} -.linkcompressed .expando-button {display: none} - .warm-entry .rank { color: #EDA179; } .hot-entry .rank { color: #E47234; } @@ -2148,8 +2105,7 @@ ul.tabmenu.formtab { /******** self text stuff ****/ -.link .usertext .md, -.linkcompressed .usertext .md { +.link .usertext .md { padding: 0 5px; background-color: #fafafa; border: 1px solid #369; diff --git a/r2/r2/public/static/js/reddit.js b/r2/r2/public/static/js/reddit.js index ceea205a0..89d8f147d 100644 --- a/r2/r2/public/static/js/reddit.js +++ b/r2/r2/public/static/js/reddit.js @@ -471,7 +471,7 @@ function updateEventHandlers(thing) { .filter(":visible").trigger("onshow"); /* click on a title.. */ - $(thing).filter(".link, .linkcompressed") + $(thing).filter(".link") .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 */ diff --git a/r2/r2/templates/link.html b/r2/r2/templates/link.html index ee8a123c9..6db73f359 100644 --- a/r2/r2/templates/link.html +++ b/r2/r2/templates/link.html @@ -131,10 +131,16 @@ <%def name="midcol(display=True, cls = '')"> + %if c.user.pref_compress: +
${self.arrow(thing, 1, thing.likes)} - %if thing.hide_score: + %if c.user.pref_compress: +
+ %elif thing.hide_score:
@@ -157,13 +163,20 @@ <% from r2.lib.utils import timeago from r2.models import FakeSubreddit - + from r2.lib.strings import Score + if isinstance(c.site, FakeSubreddit) or c.site != thing.subreddit: taglinetext = _("submitted %(when)s ago by %(author)s to %(reddit)s") else: taglinetext = _("submitted %(when)s ago by %(author)s") taglinetext = taglinetext.replace(" ", " ") %> + + %if c.user.pref_compress and not thing.hide_score: + ${self.score(thing, thing.likes, score_fmt = Score.safepoints, tag='span')} + + %endif + ${unsafe(taglinetext % dict(reddit = self.subreddit(), when = thing.timesince, author= self.author(friend = thing.friend)))} diff --git a/r2/r2/templates/linkcompressed.html b/r2/r2/templates/linkcompressed.html deleted file mode 100644 index c4d278b42..000000000 --- a/r2/r2/templates/linkcompressed.html +++ /dev/null @@ -1,60 +0,0 @@ -## The contents of this file are subject to the Common Public Attribution -## License Version 1.0. (the "License"); you may not use this file except in -## compliance with the License. You may obtain a copy of the License at -## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public -## License Version 1.1, but Sections 14 and 15 have been added to cover use of -## software over a computer network and provide for limited attribution for the -## Original Developer. In addition, Exhibit A has been modified to be consistent -## with Exhibit B. -## -## Software distributed under the License is distributed on an "AS IS" basis, -## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for -## the specific language governing rights and limitations under the License. -## -## The Original Code is Reddit. -## -## The Original Developer is the Initial Developer. The Initial Developer of -## the Original Code is CondeNet, Inc. -## -## All portions of the code written by CondeNet are Copyright (c) 2006-2009 -## CondeNet, Inc. All Rights Reserved. -################################################################################ - -<%! from r2.models.subreddit import Default %> - -<%inherit file="link.html"/> - -<%def name="domain()"> - - - (${thing.domain}) - - - -<%def name="midcol(display=True, cls = '')"> -
- ${self.arrow(thing, 1, thing.likes)} - ${self.arrow(thing, 0, thing.likes == False)} -
- - -<%def name="tagline()"> - <% - if thing.hide_score: - taglinetext = _("submitted %(when)s ago by %(author)s") - else: - taglinetext = _("%(points)s submitted %(when)s ago by %(author)s") - taglinetext = taglinetext.replace(" ", " ") - %> - ${unsafe(taglinetext % dict(points = capture(self.score, thing, likes=thing.likes), - when = thing.timesince, - author= self.author(friend = thing.friend)))} - - <% from r2.models import FakeSubreddit, Default %> - %if isinstance(c.site, FakeSubreddit): - ${unsafe( _( "to %(reddit)s") % dict(reddit=" " + self.subreddit())) } - %endif - - - diff --git a/r2/r2/templates/printable.html b/r2/r2/templates/printable.html index c46af26a7..6e0a88e96 100644 --- a/r2/r2/templates/printable.html +++ b/r2/r2/templates/printable.html @@ -61,6 +61,9 @@ thing id-${what._fullname} else: cls = thing.lookups[0].__class__.__name__.lower() + if cls == 'link' and c.user.pref_compress: + cls = 'compressed link' + if thing.show_spam: rowclass = thing.rowstyle + " spam" elif thing.show_reports: