Sha256: c6446857cba50cef02842fbcaf5aab9893811eeccc9ff8ecb8272a5a3bafd1f0

Contents?: true

Size: 1.06 KB

Versions: 21

Compression:

Stored size: 1.06 KB

Contents

module SearchHistoriesHelper
  def reverse_tag_cloud(query_and_numbers)
    return nil if query_and_numbers.nil?
    # TODO: add options to specify different limits and sorts
    #tags = Tag.all(:limit => 100, :order => 'taggings_count DESC').sort_by(&:name)

    # TODO: add option to specify which classes you want and overide this if you want?
    classes = %w(popular v-popular vv-popular vvv-popular vvvv-popular)

    max, min = 0, 0
    query_and_numbers.each do |query|
      #if options[:max] or options[:min]
      #  max = options[:max].to_i
      #  min = options[:min].to_i
      #end
      max = query[1] if query[1].to_i > max
      min = query[1] if query[1].to_i < min
    end
    divisor = ((max - min).div(classes.size)) + 1

    content_tag :div, :class => "hTagcloud" do
      content_tag :ul, :class => "popularity" do
        query_and_numbers.each do |query|
          content_tag :li do
            link_to(h(query[0]), manifestations_url(:query => query[0]), :class => classes[(query[1] - min).div(divisor)])
          end
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
enju_search_log-0.2.0 app/helpers/search_histories_helper.rb
enju_search_log-0.2.0.beta.3 app/helpers/search_histories_helper.rb
enju_search_log-0.2.0.beta.1 app/helpers/search_histories_helper.rb
enju_search_log-0.1.1 app/helpers/search_histories_helper.rb
enju_search_log-0.1.0 app/helpers/search_histories_helper.rb
enju_search_log-0.1.0.pre12 app/helpers/search_histories_helper.rb
enju_search_log-0.1.0.pre11 app/helpers/search_histories_helper.rb
enju_search_log-0.1.0.pre10 app/helpers/search_histories_helper.rb
enju_search_log-0.1.0.pre9 app/helpers/search_histories_helper.rb
enju_search_log-0.1.0.pre8 app/helpers/search_histories_helper.rb
enju_search_log-0.1.0.pre7 app/helpers/search_histories_helper.rb
enju_search_log-0.1.0.pre6 app/helpers/search_histories_helper.rb
enju_search_log-0.1.0.pre5 app/helpers/search_histories_helper.rb
enju_search_log-0.1.0.pre4 app/helpers/search_histories_helper.rb
enju_search_log-0.1.0.pre3 app/helpers/search_histories_helper.rb
enju_search_log-0.1.0.pre2 app/helpers/search_histories_helper.rb
enju_search_log-0.1.0.pre app/helpers/search_histories_helper.rb
enju_search_log-0.0.7 app/helpers/search_histories_helper.rb
enju_search_log-0.0.6 app/helpers/search_histories_helper.rb
enju_search_log-0.0.5 app/helpers/search_histories_helper.rb