Commit 1bb5712e50d9459210089fd6e49c4ad60a071e4f
1 parent
1cf5580b
Exists in
staging
and in
42 other branches
ActionItem428: remove previous added files to enterprises controller
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1997 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
9 changed files
with
5 additions
and
48 deletions
Show diff stats
app/controllers/admin/enterprises_controller.rb
app/helpers/enterprises_helper.rb
app/views/admin_panel/index.rhtml
@@ -9,5 +9,4 @@ | @@ -9,5 +9,4 @@ | ||
9 | <li><%= link_to _('Manage Categories'), :controller => 'categories'%></li> | 9 | <li><%= link_to _('Manage Categories'), :controller => 'categories'%></li> |
10 | <li><%= link_to _('Manage User roles'), :controller => 'role' %></li> | 10 | <li><%= link_to _('Manage User roles'), :controller => 'role' %></li> |
11 | <li><%= link_to _('Manage Validators by region'), :controller => 'region_validators' %></li> | 11 | <li><%= link_to _('Manage Validators by region'), :controller => 'region_validators' %></li> |
12 | - <li><%= link_to _('Manage Enterprises'), :controller => 'enterprises' %></li> | ||
13 | </ul> | 12 | </ul> |
app/views/blocks/profile_info.rhtml
@@ -6,7 +6,7 @@ | @@ -6,7 +6,7 @@ | ||
6 | <li><%= _('Since %{year}/%{month}') % { :year => block.owner.created_at.year, :month => block.owner.created_at.month } %></li> | 6 | <li><%= _('Since %{year}/%{month}') % { :year => block.owner.created_at.year, :month => block.owner.created_at.month } %></li> |
7 | <li><%= link_to _('Homepage'), block.owner.url %></li> | 7 | <li><%= link_to _('Homepage'), block.owner.url %></li> |
8 | <li><%= link_to _('View profile'), block.owner.public_profile_url %></li> | 8 | <li><%= link_to _('View profile'), block.owner.public_profile_url %></li> |
9 | - <% if profile == user %> | 9 | + <% if !user.nil? and user.has_permission?('edit_profile', profile) %> |
10 | <li><%= link_to _('Control panel'), :controller => 'profile_editor' %></li> | 10 | <li><%= link_to _('Control panel'), :controller => 'profile_editor' %></li> |
11 | <% end %> | 11 | <% end %> |
12 | </ul> | 12 | </ul> |
app/views/enterprises/index.rhtml
@@ -1,22 +0,0 @@ | @@ -1,22 +0,0 @@ | ||
1 | -<h1><%= _("%s's enterprises") % environment.name %></h1> | ||
2 | - | ||
3 | -<table> | ||
4 | -<% for enterprise in @enterprises %> | ||
5 | - <tr> | ||
6 | - <td> <%= image_tag(profile_icon(enterprise)) %> </td> | ||
7 | - <td> | ||
8 | - <%= _('Name: %s') % link_to(enterprise.name, enterprise.url) %> <br/> | ||
9 | - <%#= _('Description: %s') % enterprise.description + '<br/>' if enterprise.kind_of?(Community) %> | ||
10 | - <%= _('Created at: %s') % show_date(enterprise.created_at) %> <br/> | ||
11 | - <%= _('Actions: %s') % link_to(_('Manage'), enterprise.admin_url) %> <br/> | ||
12 | - | ||
13 | - </td> | ||
14 | - </tr> | ||
15 | -<% end %> | ||
16 | -</table> | ||
17 | - | ||
18 | -<% button_bar do %> | ||
19 | - <%#= button :add, _('Register a new Enterprise'), :controller => 'enterprise_registration' %> | ||
20 | - <%#= button :add, _('Create a new community'), :action => 'new_community' %> | ||
21 | - <%#= button :back, _('Go back'), :controller => 'profile_editor' %> | ||
22 | -<% end %> |
test/functional/admin_panel_controller_test.rb
@@ -72,9 +72,4 @@ class AdminPanelControllerTest < Test::Unit::TestCase | @@ -72,9 +72,4 @@ class AdminPanelControllerTest < Test::Unit::TestCase | ||
72 | assert_equal "This <strong>is</strong> alert('alow')my new environment", Environment.default.description | 72 | assert_equal "This <strong>is</strong> alert('alow')my new environment", Environment.default.description |
73 | end | 73 | end |
74 | 74 | ||
75 | - should 'link to manage enterprises' do | ||
76 | - get :index | ||
77 | - assert_tag :tag => 'a', :attributes => { :href => '/admin/enterprises' } | ||
78 | - end | ||
79 | - | ||
80 | end | 75 | end |
test/functional/enterprises_controller_test.rb
test/functional/profile_controller_test.rb
@@ -153,6 +153,8 @@ class ProfileControllerTest < Test::Unit::TestCase | @@ -153,6 +153,8 @@ class ProfileControllerTest < Test::Unit::TestCase | ||
153 | assert_no_tag :tag => 'ul', :attributes => { :class => 'profile-info-data' }, :descendant => { :tag => 'a', :content => 'Control panel' } | 153 | assert_no_tag :tag => 'ul', :attributes => { :class => 'profile-info-data' }, :descendant => { :tag => 'a', :content => 'Control panel' } |
154 | end | 154 | end |
155 | 155 | ||
156 | + should 'show a link to control panel if user has profile_editor permission' | ||
157 | + | ||
156 | should 'show create community in own profile' do | 158 | should 'show create community in own profile' do |
157 | login_as(@profile.identifier) | 159 | login_as(@profile.identifier) |
158 | get :communities, :profile => @profile.identifier | 160 | get :communities, :profile => @profile.identifier |
test/functional/profile_editor_controller_test.rb
@@ -310,7 +310,7 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | @@ -310,7 +310,7 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | ||
310 | user2 = create_user('usertwo').person | 310 | user2 = create_user('usertwo').person |
311 | AddFriend.create!(:person => user1, :friend => user2) | 311 | AddFriend.create!(:person => user1, :friend => user2) |
312 | @controller.stubs(:user).returns(user2) | 312 | @controller.stubs(:user).returns(user2) |
313 | - user2.expects(:has_permission?).with('edit_profile', anything).returns(true) | 313 | + user2.stubs(:has_permission?).with('edit_profile', anything).returns(true) |
314 | user2.expects(:has_permission?).with(:manage_friends, anything).returns(true) | 314 | user2.expects(:has_permission?).with(:manage_friends, anything).returns(true) |
315 | login_as('usertwo') | 315 | login_as('usertwo') |
316 | get :index, :profile => 'usertwo' | 316 | get :index, :profile => 'usertwo' |
@@ -322,7 +322,7 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | @@ -322,7 +322,7 @@ class ProfileEditorControllerTest < Test::Unit::TestCase | ||
322 | user2 = create_user('usertwo').person | 322 | user2 = create_user('usertwo').person |
323 | task = AddFriend.create!(:person => user1, :friend => user2) | 323 | task = AddFriend.create!(:person => user1, :friend => user2) |
324 | @controller.stubs(:user).returns(user2) | 324 | @controller.stubs(:user).returns(user2) |
325 | - user2.expects(:has_permission?).with('edit_profile', anything).returns(true) | 325 | + user2.stubs(:has_permission?).with('edit_profile', anything).returns(true) |
326 | user2.expects(:has_permission?).with(:manage_friends, anything).returns(false) | 326 | user2.expects(:has_permission?).with(:manage_friends, anything).returns(false) |
327 | login_as('usertwo') | 327 | login_as('usertwo') |
328 | get :index, :profile => 'usertwo' | 328 | get :index, :profile => 'usertwo' |