h1.page-header Tag Cloud
-
if @tags.empty?
.alert.alert-info
| You have no tags!
-
else
/ Artbitrary values
-
min = 12
-
max = 72
-
smaller = max
-
bigger = min
-
rate = 1
tagcloud
/ First we need to see how many links each tag has, compare with the minimum and maximum and finally calculate the growing rate for the font size - @tags.each do |tag| - current = tag.links.count - if current < min - current = min + current - if current > max - current = max - current - smaller = current if current < smaller - bigger = current if current > bigger - rate = (max-min)/(bigger-smaller) - @tags.each do |tag| - current = (tag.links.count * rate) a href="/tag/#{tag.id}" rel="#{current}" = tag.name
/ When the page loads, activate the Tag Cloud!
We need to define this function out here so it can get changed at `page-tagcloud.js`
javascript:
var activateTagCloud = function(){}
script src=“/js/lib/jquery.tagcloud.js” script src=“/js/page-tagcloud.js” javascript:
($(function () { activateTagCloud(#{smaller}, #{bigger}) }))
-