Sha256: 817d415e550fd5e8c078053c97d5880b207d59687a5ca6afdd0c0f3ffdeb8ec8

Contents?: true

Size: 593 Bytes

Versions: 21

Compression:

Stored size: 593 Bytes

Contents

class TagSidebar < Sidebar
  display_name "Tags"
  description "Show most popular tags for this blog"

  setting :maximum_tags, 20

  def tags
    @tags ||= Tag.find_all_with_article_counters(maximum_tags.to_i).sort_by {|t| t.name}
  end

  def sizes
    return @sizes if @sizes
    total = @tags.inject(0) {|total, tag| total + tag.article_counter }
    average = total.to_f / @tags.size.to_f
    @sizes = @tags.inject({}) do |h,tag|
      size = tag.article_counter.to_f / average
      h.merge tag => [[2.0/3.0, size].max, 2].min * 100
    end
  end

  def font_multiplier
    80
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
typo-5.5 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.4.4 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.4.3 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.4.2 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.4.1 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.4 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-4.1.1 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.0.1 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.0.2 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-4.1 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.0.3.98.1 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.0.3.98 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.0 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.1.1 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.1.2 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.1.3 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.1 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.1.98 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.2 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb
typo-5.2.98 vendor/plugins/tag_sidebar/lib/tag_sidebar.rb