Fork of sgarza/tag_cloud_helper
(http://github.com/sgarza/tag_cloud_helper) providing functionality for contexts or (sub-sets of tags) in the form of Sunspot search facets (Solr)
Tag Cloud Helper depends on
-
mbleigh/acts-as-taggable-on
at http://github.com/mbleigh/acts-as-taggable-on -
outoftime/sunspot_rails
at http://github.com/outoftime/sunspot_rails/
-
Install the plugin by running
script/plugin install git://github.com/edavey/tag_cloud_helper.git
This will install the
plugin in your vendor/plugins directory
. -
Use the following helper method in your view, e.g.:
<%= tag_cloud @keywords, :model => :article, :context => :keyword, :limit => 25 -%>
where the signature is:
tag_cloud(collection_of_facet_rows, {context, model, limit=30})
I assume the following:
-
that your model name corresponds to the name of the controller which your links will use. The example generates links like:
/articles?keyword=jobs
-
that if you are filtering your search results by other facets then you wish to preserve any existing url parameters and get links like:
/articles?filter=video&keyword=jobs&query=money
-
that you don't wish to preserve a
page
parameter, i.e. if you add thejobs
keyword then you want to see the first page of the new results set.
Tag Cloud Helper is released under the MIT license.
Tag Cloud Helper was created by Sergio R. de la Garza of Development and Technology Advisors S.A. de C.V. (http://www.devtech.com.mx/) and adapted for Solr and contextual tagging by edavey.