mirror of
https://github.com/TracksApp/tracks.git
synced 2026-02-05 23:41:48 +01:00
Move font calculation into tag cloud
This commit is contained in:
parent
2321d1f2a3
commit
d478efdd01
2 changed files with 11 additions and 3 deletions
|
|
@ -10,10 +10,20 @@ module Stats
|
|||
@levels = 10
|
||||
end
|
||||
|
||||
def empty?
|
||||
tags.empty?
|
||||
end
|
||||
|
||||
def font_size(tag)
|
||||
(9 + 2*(tag.count.to_i-min)/divisor)
|
||||
end
|
||||
|
||||
def tags
|
||||
@tags ||= top_tags
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def max
|
||||
@max ||= tag_counts.max
|
||||
end
|
||||
|
|
@ -30,8 +40,6 @@ module Stats
|
|||
@divisor ||= ((max - min) / levels) + 1
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def tag_counts
|
||||
@tag_counts ||= tags.map {|t| t.count.to_i}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue