7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
# File 'lib/enju_bookmark/bookmark_helper.rb', line 7
def render_tag_cloud(tags, options = {})
classes = %w(popular v-popular vv-popular vvv-popular vvvv-popular)
max, min = 0, 0
tags.each do |tag|
max = tag.taggings.size if tag.taggings.size > max
min = tag.taggings.size if tag.taggings.size < min
end
divisor = ((max - min).div(classes.size)) + 1
content_tag :div, class: "hTagcloud" do
content_tag :ul, class: "popularity" do
tags.collect do |tag|
concat(content_tag :li, link_to(tag.name, manifestations_path(tag: tag.name), class: classes[(tag.taggings.size - min).div(divisor)]) + "\n")
end
end
end
end
|