module RedmineCrm::TagsHelper

Public Instance Methods

tag_cloud(tags, classes) { |tag, classes| ... } click to toggle source

See the README for an example using tag_cloud.

# File lib/redmine_crm/helpers/tags_helper.rb, line 4
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