app/controllers/survey_respondents/tags_controller.rb
# get the tag cloud for a specific tag list
get the tag cloud for a specific tag list
get the tag cloud for a specific tag list
def cloud
    tag_context = params[:context] 
    target = params[:target] 
    limit = params[:limit] 
    @tags = TagsService.tag_counts_on(SurveyRespondent, tag_context).sort { |x, y| x.name.downcase <=> y.name.downcase }
    if limit
      l = limit.to_i
      @tags = @tags.sort { |x, y| y.count <=> x.count }
      @tags = @tags[0..(l -1)]
    end
    if target == 'selection'
      render 'selection', :layout => 'content'
    else  
      render :layout => 'content'
    end
  end
def cloud tag_context = params [ :context ] target = params [ :target ] limit = params [ :limit ] @tags = TagsService . tag_counts_on ( SurveyRespondent , tag_context ) . sort { | x , y | x . name . downcase <=> y . name . downcase } if limit l = limit . to_i @tags = @tags . sort { | x , y | y . count <=> x . count } @tags = @tags [ 0 .. ( l - 1 ) ] end if target == 'selection' render 'selection' , :layout => 'content' else render :layout => 'content' end end
get the tag cloud for a specific tag list
get the tag cloud for a specific tag list
# tag context # tag context # if there is a limit then we only report back on the limit number of tags and sort by most popular # We now have a collection of names and count, so sort based on count and limit