Commit 52c6001ca2a558e9e30d9626ce177f6cf6e292ab
Exists in
master
and in
28 other branches
Merge commit 'refs/merge-requests/361' of git://gitorious.org/noosfero/noosfero …
…into merge-requests/361
Showing
2 changed files
with
26 additions
and
12 deletions
Show diff stats
app/views/profile/_person_profile.rhtml
@@ -18,18 +18,6 @@ | @@ -18,18 +18,6 @@ | ||
18 | <% cache_timeout(profile.relationships_cache_key, 4.hours) do %> | 18 | <% cache_timeout(profile.relationships_cache_key, 4.hours) do %> |
19 | <%= display_work_info profile %> | 19 | <%= display_work_info profile %> |
20 | 20 | ||
21 | - <% if !environment.enabled?('disable_asset_enterprises') && !profile.enterprises.empty? %> | ||
22 | - <tr> | ||
23 | - <th colspan='2'><%= __('Enterprises') %></th> | ||
24 | - </tr> | ||
25 | - <% profile.enterprises.includes(:environment,:domains, :preferred_domain).each do |item| %> | ||
26 | - <tr> | ||
27 | - <td></td> | ||
28 | - <td><%= button 'menu-enterprise', item.name, item.url %></td> | ||
29 | - </tr> | ||
30 | - <% end %> | ||
31 | - <% end %> | ||
32 | - | ||
33 | <tr> | 21 | <tr> |
34 | <th colspan='2'><%= _('Network')%></th> | 22 | <th colspan='2'><%= _('Network')%></th> |
35 | </tr> | 23 | </tr> |
@@ -41,6 +29,12 @@ | @@ -41,6 +29,12 @@ | ||
41 | <td><%= __('Communities') + ':' %></td> | 29 | <td><%= __('Communities') + ':' %></td> |
42 | <td><%= link_to profile.communities.count, :controller => "profile", :action => 'communities' %></td> | 30 | <td><%= link_to profile.communities.count, :controller => "profile", :action => 'communities' %></td> |
43 | </tr> | 31 | </tr> |
32 | + <% if environment.disabled?('disable_asset_enterprises') %> | ||
33 | + <tr id="person-profile-network-enterprises"> | ||
34 | + <td><%= __('Enterprises') + ':' %></td> | ||
35 | + <td><%= link_to profile.enterprises.count, :controller => "profile", :action => 'enterprises' %></td> | ||
36 | + </tr> | ||
37 | + <% end %> | ||
44 | 38 | ||
45 | <%= render :partial => 'common' %> | 39 | <%= render :partial => 'common' %> |
46 | 40 |
test/functional/profile_controller_test.rb
@@ -1550,4 +1550,24 @@ class ProfileControllerTest < ActionController::TestCase | @@ -1550,4 +1550,24 @@ class ProfileControllerTest < ActionController::TestCase | ||
1550 | assert_tag :tag => 'td', :content => 'e-Mail:' | 1550 | assert_tag :tag => 'td', :content => 'e-Mail:' |
1551 | end | 1551 | end |
1552 | 1552 | ||
1553 | + should 'show enterprises field if enterprises are enabled on environment' do | ||
1554 | + person = fast_create(Person) | ||
1555 | + environment = person.environment | ||
1556 | + environment.disable('disable_asset_enterprises') | ||
1557 | + environment.save! | ||
1558 | + | ||
1559 | + get :index, :profile => person.identifier | ||
1560 | + assert_tag :tag => 'tr', :attributes => { :id => "person-profile-network-enterprises" } | ||
1561 | + end | ||
1562 | + | ||
1563 | + should 'not show enterprises field if enterprises are disabled on environment' do | ||
1564 | + person = fast_create(Person) | ||
1565 | + environment = person.environment | ||
1566 | + environment.enable('disable_asset_enterprises') | ||
1567 | + environment.save! | ||
1568 | + | ||
1569 | + get :index, :profile => person.identifier | ||
1570 | + assert_no_tag :tag => 'tr', :attributes => { :id => "person-profile-network-enterprises" } | ||
1571 | + end | ||
1572 | + | ||
1553 | end | 1573 | end |