diff --git a/app/views/profile/_person_profile.rhtml b/app/views/profile/_person_profile.rhtml index 9fac130..d739011 100644 --- a/app/views/profile/_person_profile.rhtml +++ b/app/views/profile/_person_profile.rhtml @@ -18,18 +18,6 @@ <% cache_timeout(profile.relationships_cache_key, 4.hours) do %> <%= display_work_info profile %> - <% if !environment.enabled?('disable_asset_enterprises') && !profile.enterprises.empty? %> - - <%= __('Enterprises') %> - - <% profile.enterprises.includes(:environment,:domains, :preferred_domain).each do |item| %> - - - <%= button 'menu-enterprise', item.name, item.url %> - - <% end %> - <% end %> - <%= _('Network')%> @@ -41,6 +29,12 @@ <%= __('Communities') + ':' %> <%= link_to profile.communities.count, :controller => "profile", :action => 'communities' %> + <% if environment.disabled?('disable_asset_enterprises') %> + + <%= __('Enterprises') + ':' %> + <%= link_to profile.enterprises.count, :controller => "profile", :action => 'enterprises' %> + + <% end %> <%= render :partial => 'common' %> diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index 3e31b06..8cf0f8d 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -1550,4 +1550,24 @@ class ProfileControllerTest < ActionController::TestCase assert_tag :tag => 'td', :content => 'e-Mail:' end + should 'show enterprises field if enterprises are enabled on environment' do + person = fast_create(Person) + environment = person.environment + environment.disable('disable_asset_enterprises') + environment.save! + + get :index, :profile => person.identifier + assert_tag :tag => 'tr', :attributes => { :id => "person-profile-network-enterprises" } + end + + should 'not show enterprises field if enterprises are disabled on environment' do + person = fast_create(Person) + environment = person.environment + environment.enable('disable_asset_enterprises') + environment.save! + + get :index, :profile => person.identifier + assert_no_tag :tag => 'tr', :attributes => { :id => "person-profile-network-enterprises" } + end + end -- libgit2 0.21.2