From fe89e1a39220dad9f9638f4b2ad678a2aa2e4706 Mon Sep 17 00:00:00 2001 From: JoenioCosta Date: Tue, 29 Apr 2008 04:10:01 +0000 Subject: [PATCH] ActionItem301: show control panel link in own person profile --- app/views/blocks/profile_info.rhtml | 3 +++ test/functional/my_profile_controller_test.rb | 1 - test/functional/profile_controller_test.rb | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/views/blocks/profile_info.rhtml b/app/views/blocks/profile_info.rhtml index fb7e0cd..ace35f6 100644 --- a/app/views/blocks/profile_info.rhtml +++ b/app/views/blocks/profile_info.rhtml @@ -6,6 +6,9 @@
  • <%= _('Since %{year}/%{month}') % { :year => block.owner.created_at.year, :month => block.owner.created_at.month } %>
  • <%= link_to _('Homepage'), block.owner.url %>
  • <%= link_to _('View profile'), block.owner.public_profile_url %>
  • + <% if profile == user %> +
  • <%= link_to _('Control panel'), :controller => 'profile_editor' %>
  • + <% end %>
    diff --git a/test/functional/my_profile_controller_test.rb b/test/functional/my_profile_controller_test.rb index bebaf4a..69f53e5 100644 --- a/test/functional/my_profile_controller_test.rb +++ b/test/functional/my_profile_controller_test.rb @@ -24,7 +24,6 @@ class MyProfileControllerTest < Test::Unit::TestCase @controller = OnlyForPersonTestController.new user = create_user('test_user').person assert_local_files_reference :get, :index, :profile => user.identifier - #get :index, :profile => user.identifier end def test_valid_xhtml diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index 3c825c3..fd42888 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -132,4 +132,17 @@ class ProfileControllerTest < Test::Unit::TestCase assert_tag :tag => 'a', :attributes => { :href => '/tag/tag1' }, :content => 'See content tagged with "tag1" in the entire site' end + should 'show a link to own control panel' do + login_as(@profile.identifier) + get :index, :profile => @profile.identifier + assert_tag :tag => 'ul', :attributes => { :class => 'profile-info-data' }, :descendant => { :tag => 'a', :content => 'Control panel' } + end + + should 'not show a link to others control panel' do + login_as(@profile.identifier) + other = create_user('person_1').person + get :index, :profile => other.identifier + assert_no_tag :tag => 'ul', :attributes => { :class => 'profile-info-data' }, :descendant => { :tag => 'a', :content => 'Control panel' } + end + end -- libgit2 0.21.2