Sha256: d1c8dd842558cb50867cde898fbb70e8ece7ea14cb6051e5d8a0de1b0c5d7c56
Contents?: true
Size: 363 Bytes
Versions: 2
Compression:
Stored size: 363 Bytes
Contents
module YeshuaCrm module TagsHelper # See the README for an example using tag_cloud. def tag_cloud(tags, classes) return if tags.empty? max_count = tags.sort_by(&:count).last.count.to_f tags.each do |tag| index = ((tag.count / max_count) * (classes.size - 1)).round yield tag, classes[index] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
yeshua_crm-1.0.1 | lib/yeshua_crm/helpers/tags_helper.rb |
yeshua_crm-1.0.0 | lib/yeshua_crm/helpers/tags_helper.rb |