Commit afcbe97285bdb5fc85c5f2f7bcb690fef9a1b3eb
1 parent
179d8266
Exists in
master
and in
28 other branches
ActionItem457: fixing footer for environment
don't generate "All content" links when the "Recent Documents" block is owned by an environment environment git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2047 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
2 changed files
with
10 additions
and
0 deletions
Show diff stats
app/models/recent_documents_block.rb
| ... | ... | @@ -16,6 +16,8 @@ class RecentDocumentsBlock < Block |
| 16 | 16 | end |
| 17 | 17 | |
| 18 | 18 | def footer |
| 19 | + return nil unless self.owner.is_a?(Profile) | |
| 20 | + | |
| 19 | 21 | profile = self.owner |
| 20 | 22 | lambda do |
| 21 | 23 | link_to _('All content'), :profile => profile.identifier, :controller => 'profile', :action => 'sitemap' | ... | ... |
test/unit/recent_documents_block_test.rb
| ... | ... | @@ -62,4 +62,12 @@ class RecentDocumentsBlockTest < Test::Unit::TestCase |
| 62 | 62 | instance_eval(&(block.footer)) |
| 63 | 63 | end |
| 64 | 64 | |
| 65 | + should 'not display link to sitemap when owner is environment' do | |
| 66 | + block = RecentDocumentsBlock.new | |
| 67 | + box = mock | |
| 68 | + block.expects(:box).returns(box).at_least_once | |
| 69 | + box.expects(:owner).returns(Environment.new).at_least_once | |
| 70 | + assert_equal nil, block.footer | |
| 71 | + end | |
| 72 | + | |
| 65 | 73 | end | ... | ... |