0.0
No commit activity in last 3 years
No release in over 3 years
TintedTags is a Rails Gem that extends functionality of ActsAsTaggableOn with the ability to assign colours to tags based upon their usage.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 3.2.11
 Project Readme

TintedTags

This plugin is to be used with acts_as_taggable_on. TintedTags allows you to create a tag cloud where tag popularity is illustrated with colour. It achieves this by adding a :tint attribute to the Tag model, and allows you to calculate a colour (in the form of a hex code) for each tag based on its popularity. These hex codes are added to the tags in the view via inline-css.

Tags are updated via an after_save filter on a TintedTags object.

Installation

Rails 3.x

To use it, add it to your Gemfile:

gem 'acts-as-taggable-on', '~> 2.3.1'
gem 'tinted_tags'

Post Installation

rails generate tinted_tags:migration
rake db:migrate

Usage

Model

acts_as_taggable_on
tinted_tags base: '#ffffff', tint: '#000000'

Controller

@tags = Post.tag_counts_on(:tags).order('count desc')

Views

tinted_tag_cloud

returns ..

<ul class="tinted-tag-cloud">
  <li style="background-color: #ffffff">one</li>
  <li style="background-color: #7f7f7f">two</li>
</ul>

Author

Copyright (c) Ben Woodward (http://benw.me/) Copyright Released under the MIT license