diff --git a/app/helpers/tags_helper.rb b/app/helpers/tags_helper.rb index 7acf7bd..fef502a 100644 --- a/app/helpers/tags_helper.rb +++ b/app/helpers/tags_helper.rb @@ -28,14 +28,13 @@ module TagsHelper # courtesy of Aurelio: http://www.colivre.coop.br/Aurium/Nuvem # (pt_BR only). def tag_cloud(tags, tagname_option, url, options = {}) + return content_tag('em', _('No tags yet.')) + ' (' + _('What are tags?') + ')' if tags.empty? - tags = tags.sort_by{ |k,v| k.downcase } - max_size = options[:max_size] || Cloud::MAX_SIZE min_size = options[:min_size] || Cloud::MIN_SIZE diff --git a/app/models/tags_block.rb b/app/models/tags_block.rb index bc0e520..ef4d093 100644 --- a/app/models/tags_block.rb +++ b/app/models/tags_block.rb @@ -24,7 +24,9 @@ class TagsBlock < Block return '' if tags.empty? if limit - tags = tags.sort_by{ |k,v| -v }[0..(limit-1)] + tags_tmp = tags.sort_by{ |k,v| -v }[0..(limit-1)] + tags = {} + tags_tmp.map{ |k,v| tags[k] = v } end block_title(title) + diff --git a/public/designs/themes/base/style.css b/public/designs/themes/base/style.css index f2b197b..12a0073 100644 --- a/public/designs/themes/base/style.css +++ b/public/designs/themes/base/style.css @@ -695,7 +695,6 @@ div#notice { .tag_cloud a { text-decoration: none; - white-space: nowrap; } .tag_cloud a small { diff --git a/test/unit/tags_block_test.rb b/test/unit/tags_block_test.rb index 1bd1ae2..5b5863d 100644 --- a/test/unit/tags_block_test.rb +++ b/test/unit/tags_block_test.rb @@ -37,8 +37,4 @@ class TagsBlockTest < Test::Unit::TestCase assert_match /profile\/testinguser\/tags\/first-tag/, block.content end - should 'order tags alphabetically' do - assert /\/first-tag".*\/second-tag".*\/third-tag"/m =~ block.content - end - end diff --git a/test/unit/tags_helper_test.rb b/test/unit/tags_helper_test.rb deleted file mode 100644 index da5f0ae..0000000 --- a/test/unit/tags_helper_test.rb +++ /dev/null @@ -1,21 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class TagsHelperTest < Test::Unit::TestCase - - include ApplicationHelper - include TagsHelper - include ActionController::UrlWriter - - def h(s); s; end - def link_to(text, *args); text; end - - should 'order tags alphabetically' do - result = tag_cloud( - { 'tag1'=>9, 'Tag3'=>2, 'Tag2'=>2, 'aTag'=>2, 'beTag'=>2 }, - :id, - { :host=>'noosfero.org', :controller=>'test', :action=>'tag' } - ) - assert_equal %w(aTag beTag tag1 Tag2 Tag3).join("\n"), result - end - -end -- libgit2 0.21.2