Commit 1db099271209bc4413ed8040d6b0a5d6366944e8
1 parent
2c492707
Exists in
master
and in
29 other branches
ActionItem521: not showing tags block without tags
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2126 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
6 additions
and
2 deletions
Show diff stats
app/models/tags_block.rb
@@ -14,6 +14,9 @@ class TagsBlock < Block | @@ -14,6 +14,9 @@ class TagsBlock < Block | ||
14 | end | 14 | end |
15 | 15 | ||
16 | def content | 16 | def content |
17 | + tags = owner.tags | ||
18 | + return '' if tags.empty? | ||
19 | + | ||
17 | block_title( _('tags') ) + | 20 | block_title( _('tags') ) + |
18 | "\n<div class='tag_cloud'>\n"+ | 21 | "\n<div class='tag_cloud'>\n"+ |
19 | tag_cloud( owner.tags, :id, | 22 | tag_cloud( owner.tags, :id, |
test/unit/tags_block_test.rb
@@ -23,8 +23,9 @@ class TagsBlockTest < Test::Unit::TestCase | @@ -23,8 +23,9 @@ class TagsBlockTest < Test::Unit::TestCase | ||
23 | assert_match /profile\/testinguser\/tag\/third-tag/, block.content | 23 | assert_match /profile\/testinguser\/tag\/third-tag/, block.content |
24 | end | 24 | end |
25 | 25 | ||
26 | - should 'display owner name in tags' do | ||
27 | - assert_match "testinguser's tags", block.content | 26 | + should 'return (none) when no tags to display' do |
27 | + block.owner.expects(:tags).returns([]) | ||
28 | + assert_equal '', block.content | ||
28 | end | 29 | end |
29 | 30 | ||
30 | end | 31 | end |