Sha256: 356805267c47aeaa40c0c986f6c45b9f118b3433883b7b9fa584ecc265b67d0c

Contents?: true

Size: 363 Bytes

Versions: 4

Compression:

Stored size: 363 Bytes

Contents

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

4 entries across 4 versions & 1 rubygems

Version Path
redmineup-1.0.5 lib/redmineup/helpers/tags_helper.rb
redmineup-1.0.4 lib/redmineup/helpers/tags_helper.rb
redmineup-1.0.3 lib/redmineup/helpers/tags_helper.rb
redmineup-1.0.2 lib/redmineup/helpers/tags_helper.rb