mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-04-27 03:00:12 -04:00
Move display sizing logic out of linklisting template.
This commit is contained in:
@@ -277,6 +277,13 @@ class LinkListing(Listing):
|
||||
|
||||
self.show_nums = kw.get('show_nums', False)
|
||||
|
||||
def listing(self, *args, **kwargs):
|
||||
wrapped = Listing.listing(self, *args, **kwargs)
|
||||
self.rank_width = len(str(self.max_num)) * 1.1
|
||||
self.midcol_width = max(len(str(self.max_score)), 2) + 1.1
|
||||
return wrapped
|
||||
|
||||
|
||||
class NestedListing(Listing):
|
||||
def __init__(self, *a, **kw):
|
||||
Listing.__init__(self, *a, **kw)
|
||||
|
||||
@@ -24,10 +24,10 @@
|
||||
## without late rendering or blasting style attributes everywhere
|
||||
<style>
|
||||
body > .content .link .rank {
|
||||
width: ${len(str(thing.max_num)) * 1.1}ex
|
||||
width: ${thing.rank_width}ex
|
||||
}
|
||||
body > .content .link .midcol {
|
||||
width: ${max(len(str(thing.max_score)), 2) + 1.1}ex
|
||||
width: ${thing.midcol_width}ex
|
||||
}
|
||||
</style>
|
||||
<%include file="listing.html"/>
|
||||
|
||||
Reference in New Issue
Block a user