Commit 0c621a13bd8ace5cd7cab92442d71ed0d122981b

Authored by AntonioTerceiro
1 parent a93d7cfc

ActionItem154: only display countent count if asked for it


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1422 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 1 changed file with 4 additions and 1 deletions   Show diff stats
app/helpers/tags_helper.rb
@@ -22,6 +22,7 @@ module TagsHelper @@ -22,6 +22,7 @@ module TagsHelper
22 # 22 #
23 # * <tt>:max_size</tt>: font size for the tag with largest count 23 # * <tt>:max_size</tt>: font size for the tag with largest count
24 # * <tt>:min_size</tt>: font size for the tag with smallest count 24 # * <tt>:min_size</tt>: font size for the tag with smallest count
  25 + # * <tt>:show_count</tt>: whether to show the count of contents for each tag. Defauls to <tt>false</tt>.
25 # 26 #
26 # The algorithm for generating the different sizes and positions is a 27 # The algorithm for generating the different sizes and positions is a
27 # courtesy of Aurelio: http://www.colivre.coop.br/Aurium/Nuvem 28 # courtesy of Aurelio: http://www.colivre.coop.br/Aurium/Nuvem
@@ -47,7 +48,9 @@ module TagsHelper @@ -47,7 +48,9 @@ module TagsHelper
47 "top: #{ -4 - (v * 4).round }px;" 48 "top: #{ -4 - (v * 4).round }px;"
48 destination = url.kind_of?(Hash) ? url_for(url.merge(tagname_option => tag)) : (url.to_s + tag) 49 destination = url.kind_of?(Hash) ? url_for(url.merge(tagname_option => tag)) : (url.to_s + tag)
49 50
50 - link_to "#{tag}<small><sup>(#{count})</sup></small>", destination, :style => style 51 + display_count = options[:show_count] ? "<small><sup>(#{count})</sup></small>" : ""
  52 +
  53 + link_to tag + display_count, destination, :style => style
51 end.join("\n") 54 end.join("\n")
52 end 55 end
53 56