This repository has been archived by the owner on Jan 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
YOSHIDA Hiroki
committed
Jan 13, 2014
1 parent
aa0eec5
commit 0de27d1
Showing
4 changed files
with
7 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
module HomeHelper | ||
def font_size_for_tag_cloud(tag, options={}) | ||
options[:base_font_size] = 9 | ||
options[:offset_ratio] = 0.5 | ||
options[:max_offset_size] = 50 | ||
offset_font_size = [tag.name_count * options[:offset_ratio], options[:max_offset_size]].min.floor | ||
options[:base_font_size] ||= 10 | ||
options[:max_offset_size] ||= 30 | ||
offset_font_size = (options[:max_offset_size] * (tag.name_count.to_f / options[:max_count].to_f)).floor | ||
"font-size: #{options[:base_font_size] + offset_font_size}pt" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters