35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# File 'app/helpers/megatron/progress_helper.rb', line 35
def capacity_bar(size, total=100, options={})
if total.is_a?(Hash)
options = total
total = 100
end
percentage = ((size.to_f / total.to_f) * 100).round
if percentage > 90
options[:color] = 'red'
elsif percentage > 80
options[:color] = 'orange'
end
unless options.delete(:label) == false
options[:label] = "#{percentage}% - #{number_to_human_size(size).sub(' ','')} / #{number_to_human_size(total).sub(' ','')}"
end
progress_bar(percentage, options)
end
|