Commit 3d48702e65df8eff4c292c79fe10910ff00b5165

Authored by MoisesMachado
1 parent 21897056

ActionItem167: tested and added members listing


git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1508 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/controllers/public/profile_controller.rb
@@ -24,4 +24,7 @@ class ProfileController < ApplicationController @@ -24,4 +24,7 @@ class ProfileController < ApplicationController
24 @friends= profile.friends 24 @friends= profile.friends
25 end 25 end
26 26
  27 + def members
  28 + @members = profile.members
  29 + end
27 end 30 end
app/views/profile/index.rhtml
@@ -14,6 +14,9 @@ @@ -14,6 +14,9 @@
14 <li><%= link_to_function _('Friends'), 'alert(%s)' % _('This function is not available yet.').inspect %></li> 14 <li><%= link_to_function _('Friends'), 'alert(%s)' % _('This function is not available yet.').inspect %></li>
15 <li><%= link_to _('Communities'), :action => 'communities' %></li> 15 <li><%= link_to _('Communities'), :action => 'communities' %></li>
16 <li><%= link_to _('Enterprises'), :action => 'enterprises' %></li> 16 <li><%= link_to _('Enterprises'), :action => 'enterprises' %></li>
  17 + <% if profile.kind_of? Organization %>
  18 + <li><%= link_to _('Members'), :action => 'members' %></li>
  19 + <% end %>
17 20
18 <li> 21 <li>
19 <%= _('Tags:') %> 22 <%= _('Tags:') %>
app/views/profile/members.rhtml 0 → 100644
@@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
  1 +<h1><%= _("%s' members") % profile.name %></h1>
  2 +
  3 +<ul class='profile-list'>
  4 + <% @members.each do |member| %>
  5 + <li><%= profile_image_link(member) %></li>
  6 + <% end %>
  7 +</ul>
  8 +
  9 +<% button_bar do %>
  10 + <%= button(:back, _('Go back'), :controller => 'profile') %>
  11 +<% end %>
test/functional/profile_controller_test.rb
@@ -23,10 +23,27 @@ class ProfileControllerTest &lt; Test::Unit::TestCase @@ -23,10 +23,27 @@ class ProfileControllerTest &lt; Test::Unit::TestCase
23 assert_kind_of Array, assigns(:friends) 23 assert_kind_of Array, assigns(:friends)
24 end 24 end
25 25
26 - should 'list communities' 26 + should 'list communities' do
  27 + get :communities
27 28
28 - should 'list environments' 29 + assert_response :success
  30 + assert_template 'communities'
  31 + assert_kind_of Array, assigns(:communities)
  32 + end
  33 +
  34 + should 'list enterprises' do
  35 + get :enterprises
  36 +
  37 + assert_response :success
  38 + assert_template 'enterprises'
  39 + assert_kind_of Array, assigns(:enterprises)
  40 + end
29 41
30 - should 'list members (for organizations)' 42 + should 'list members (for organizations)' do
  43 + get :members
31 44
  45 + assert_response :success
  46 + assert_template 'members'
  47 + assert_kind_of Array, assigns(:members)
  48 + end
32 end 49 end