FIX: proper support for pixel ratios up to 3

This commit is contained in:
Régis Hanol
2015-05-29 09:57:54 +02:00
parent 4215690f40
commit c3227b69fa
3 changed files with 14 additions and 12 deletions

View File

@ -78,11 +78,18 @@ module Discourse
@anonymous_top_menu_items ||= Discourse.anonymous_filters + [:category, :categories, :top]
end
PIXEL_RATIOS ||= [1, 2, 3]
def self.avatar_sizes
# Don't cache until we can get a notification from site settings to expire cache
set = Set.new(SiteSetting.avatar_sizes.split("|").map(&:to_i))
# add retinas which are 2x dpi
set.to_a.each { |size| set << size * 2 }
# TODO: should cache these when we get a notification system for site settings
set = Set.new
SiteSetting.avatar_sizes.split("|").map(&:to_i).each do |size|
PIXEL_RATIOS.each do |pixel_ratio|
set << size * pixel_ratio
end
end
set
end