Sha256: 23dc017be9080970761bd559f893e71654751631a779b5c6385cce95be3749c4

Contents?: true

Size: 364 Bytes

Versions: 37

Compression:

Stored size: 364 Bytes

Contents

module RedmineCrm
  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

37 entries across 37 versions & 1 rubygems

Version Path
redmine_crm-0.0.43 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.42 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.41 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.40 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.38 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.37 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.36 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.35 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.34 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.33 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.32 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.31 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.30 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.28 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.27 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.26 lib/redmine_crm/helpers/tags_helper.rb
redmine_crm-0.0.25 lib/redmine_crm/helpers/tags_helper.rb