Module: Monologue::TagsHelper
- Included in:
- ApplicationHelper
- Defined in:
- app/helpers/monologue/tags_helper.rb
Constant Summary collapse
- NUMBER_OF_LABEL_SIZES =
Number of sizes defined in the css
5
Instance Method Summary collapse
Instance Method Details
#label_for_tag(tag, min, max) ⇒ Object
11 12 13 |
# File 'app/helpers/monologue/tags_helper.rb', line 11 def label_for_tag(tag, min, max) "label-size-#{size_for_tag(tag, min, max)}" end |
#size_for_tag(tag, min, max) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'app/helpers/monologue/tags_helper.rb', line 15 def size_for_tag(tag, min, max) #logarithmic scaling based on the number of occurrences of each tag if min<max && tag.frequency>0 1 + ((NUMBER_OF_LABEL_SIZES-1)*(log_distance_to_min(tag.frequency, min))/log_distance_to_min(max, min)).round else 1 end end |