Commit 55952f37d6f91330197daa8d2ca4c627be9485ba

Authored by AntonioTerceiro
1 parent 1b1445d7

ActionItem36: pointing to /profile/${person}/friends


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1513 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/models/friends_block.rb
@@ -8,6 +8,13 @@ class FriendsBlock < ProfileListBlock @@ -8,6 +8,13 @@ class FriendsBlock < ProfileListBlock
8 _('Friends') 8 _('Friends')
9 end 9 end
10 10
  11 + def footer
  12 + owner_id = owner.identifier
  13 + lambda do
  14 + link_to _('All friends'), :profile => owner_id, :controller => 'profile', :action => 'friends'
  15 + end
  16 + end
  17 +
11 class FriendsBlock::Finder < ProfileListBlock::Finder 18 class FriendsBlock::Finder < ProfileListBlock::Finder
12 def ids 19 def ids
13 self.block.owner.friend_ids 20 self.block.owner.friend_ids
public/stylesheets/blocks/friends-block.css 0 → 120000
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +profile-list-block.css
0 \ No newline at end of file 2 \ No newline at end of file
public/stylesheets/blocks/profile-list-block.css
@@ -56,12 +56,14 @@ @@ -56,12 +56,14 @@
56 } 56 }
57 57
58 .enterprises-block .block-footer-content, 58 .enterprises-block .block-footer-content,
  59 +.friends-block .block-footer-content,
59 .communities-block .block-footer-content { 60 .communities-block .block-footer-content {
60 text-align: center; 61 text-align: center;
61 font-size: 80%; 62 font-size: 80%;
62 padding: 5px 0px 0px 0px; 63 padding: 5px 0px 0px 0px;
63 } 64 }
64 .msie .enterprises-block .block-footer-content, 65 .msie .enterprises-block .block-footer-content,
  66 +.msie .friends-block .block-footer-content,
65 .msie .communities-block .block-footer-content { 67 .msie .communities-block .block-footer-content {
66 padding: 0px; 68 padding: 0px;
67 margin-top: -5px; 69 margin-top: -5px;
test/unit/friends_block_test.rb
@@ -31,4 +31,16 @@ class FriendsBlockTest &lt; ActiveSupport::TestCase @@ -31,4 +31,16 @@ class FriendsBlockTest &lt; ActiveSupport::TestCase
31 assert_equivalent [p2, p3, p4], block.profiles 31 assert_equivalent [p2, p3, p4], block.profiles
32 end 32 end
33 33
  34 + should 'point to list with all friends' do
  35 + block = FriendsBlock.new
  36 + user = mock
  37 + user.expects(:identifier).returns('theuser')
  38 + block.expects(:owner).returns(user)
  39 +
  40 + def self._(s); s; end
  41 + expects(:link_to).with('All friends', :profile => 'theuser', :controller => 'profile', :action => 'friends')
  42 +
  43 + instance_eval(&block.footer)
  44 + end
  45 +
34 end 46 end