From 693f200171eda6f2fc3ab36c264795bf1d4a6f50 Mon Sep 17 00:00:00 2001 From: Victor Costa Date: Thu, 20 Feb 2014 15:55:33 -0300 Subject: [PATCH] rails3: fix profile_controller --- app/controllers/public/profile_controller.rb | 8 -------- app/views/blocks/profile_image.html.erb | 2 +- app/views/blocks/profile_info.html.erb | 4 ++-- test/functional/profile_controller_test.rb | 26 +++++++++++++------------- 4 files changed, 16 insertions(+), 24 deletions(-) diff --git a/app/controllers/public/profile_controller.rb b/app/controllers/public/profile_controller.rb index 966917c..6d70656 100644 --- a/app/controllers/public/profile_controller.rb +++ b/app/controllers/public/profile_controller.rb @@ -304,14 +304,6 @@ class ProfileController < PublicController end end - def profile_info - begin - @block = profile.blocks.find(params[:block_id]) - rescue - render :text => _('Profile information could not be loaded') - end - end - def report_abuse @abuse_report = AbuseReport.new render :layout => false diff --git a/app/views/blocks/profile_image.html.erb b/app/views/blocks/profile_image.html.erb index be1f7ef..21a8d6b 100644 --- a/app/views/blocks/profile_image.html.erb +++ b/app/views/blocks/profile_image.html.erb @@ -16,7 +16,7 @@ <% if !user.nil? and user.has_permission?('edit_profile', profile) %> <% end %> diff --git a/app/views/blocks/profile_info.html.erb b/app/views/blocks/profile_info.html.erb index c1bb45d..2a59ff6 100644 --- a/app/views/blocks/profile_info.html.erb +++ b/app/views/blocks/profile_info.html.erb @@ -21,7 +21,7 @@
  • <%= link_to(_('Products/Services'), :controller => 'catalog', :profile => block.owner.identifier) %>
  • <% end %> <% if !user.nil? and user.has_permission?('edit_profile', profile) %> -
  • <%= link_to _('Control panel'), :controller => 'profile_editor' %>
  • +
  • <%= link_to _('Control panel'), block.owner.admin_url %>
  • <% end %> <% if profile.person? %>
  • <%= _('Since %{year}/%{month}') % { :year => block.owner.created_at.year, :month => block.owner.created_at.month } %>
  • @@ -40,7 +40,7 @@ <% end %>
    - <%= render :file => view_for_profile_actions(@block.owner.class) %> + <%= render :file => view_for_profile_actions(block.owner.class) %>
    diff --git a/test/functional/profile_controller_test.rb b/test/functional/profile_controller_test.rb index 7bad7fd..8644298 100644 --- a/test/functional/profile_controller_test.rb +++ b/test/functional/profile_controller_test.rb @@ -173,7 +173,7 @@ class ProfileControllerTest < ActionController::TestCase should 'not show Leave This Community button for non-registered users' do community = Community.create!(:name => 'my test community') community.boxes.first.blocks << block = ProfileInfoBlock.create! - get :profile_info, :profile => community.identifier, :block_id => block.id + get :index, :profile => community.identifier assert_no_match /\/profile\/#{@profile.identifier}\/leave/, @response.body end @@ -203,7 +203,7 @@ class ProfileControllerTest < ActionController::TestCase friend = create_user_full('friendtestuser').person friend.user.activate friend.boxes.first.blocks << block = ProfileInfoBlock.create! - get :profile_info, :profile => friend.identifier, :block_id => block.id + get :index, :profile => friend.identifier assert_match /Add friend/, @response.body end @@ -212,7 +212,7 @@ class ProfileControllerTest < ActionController::TestCase friend = create_user_full('friendtestuser').person friend.boxes.first.blocks << block = ProfileInfoBlock.create! AddFriend.create!(:person => @profile, :friend => friend) - get :profile_info, :profile => friend.identifier, :block_id => block.id + get :index, :profile => friend.identifier assert_no_match /Add friend/, @response.body end @@ -223,7 +223,7 @@ class ProfileControllerTest < ActionController::TestCase @profile.add_friend(friend) @profile.friends.reload assert @profile.is_a_friend?(friend) - get :profile_info, :profile => friend.identifier, :block_id => block.id + get :index, :profile => friend.identifier assert_no_match /Add friend/, @response.body end @@ -298,13 +298,13 @@ class ProfileControllerTest < ActionController::TestCase should 'display contact us for enterprises' do ent = Enterprise.create!(:name => 'my test enterprise', :identifier => 'my-test-enterprise') ent.boxes.first.blocks << block = ProfileInfoBlock.create! - get :profile_info, :profile => 'my-test-enterprise', :block_id => block.id + get :index, :profile => 'my-test-enterprise' assert_match /\/contact\/my-test-enterprise\/new/, @response.body end should 'not display contact us for non-enterprises' do @profile.boxes.first.blocks << block = ProfileInfoBlock.create! - get :profile_info, :profile => @profile.identifier, :block_id => block.id + get :index, :profile => @profile.identifier assert_no_match /\/contact\/#{@profile.identifier}\/new/, @response.body end @@ -312,7 +312,7 @@ class ProfileControllerTest < ActionController::TestCase ent = Enterprise.create! :name => 'my test enterprise', :identifier => 'my-test-enterprise' ent.boxes.first.blocks << block = ProfileInfoBlock.create! ent.update_attribute(:enable_contact_us, false) - get :profile_info, :profile => 'my-test-enterprise', :block_id => block.id + get :index, :profile => 'my-test-enterprise' assert_no_match /\/contact\/my-test-enterprise\/new/, @response.body end @@ -325,7 +325,7 @@ class ProfileControllerTest < ActionController::TestCase env.disable('disable_contact_person') env.save! login_as(@profile.identifier) - get :profile_info, :profile => friend.identifier, :block_id => block.id + get :index, :profile => friend.identifier assert_match /\/contact\/#{friend.identifier}\/new/, @response.body end @@ -333,7 +333,7 @@ class ProfileControllerTest < ActionController::TestCase nofriend = create_user_full('no_friend').person nofriend.boxes.first.blocks << block = ProfileInfoBlock.create! login_as(@profile.identifier) - get :profile_info, :profile => nofriend.identifier, :block_id => block.id + get :index, :profile => nofriend.identifier assert_no_match /\/contact\/#{nofriend.identifier}\/new/, @response.body end @@ -346,7 +346,7 @@ class ProfileControllerTest < ActionController::TestCase env.save! @profile.add_friend(friend) login_as(@profile.identifier) - get :profile_info, :profile => friend.identifier, :block_id => block.id + get :index, :profile => friend.identifier assert_match /\/contact\/#{friend.identifier}\/new/, @response.body end @@ -358,7 +358,7 @@ class ProfileControllerTest < ActionController::TestCase env.save! @profile.add_friend(friend) login_as(@profile.identifier) - get :profile_info, :profile => friend.identifier, :block_id => block.id + get :index, :profile => friend.identifier assert_no_match /\/contact\/#{friend.identifier}\/new/, @response.body end @@ -370,7 +370,7 @@ class ProfileControllerTest < ActionController::TestCase env.save! community.add_member(@profile) login_as(@profile.identifier) - get :profile_info, :profile => community.identifier, :block_id => block.id + get :index, :profile => community.identifier assert_match /\/contact\/#{community.identifier}\/new/, @response.body end @@ -382,7 +382,7 @@ class ProfileControllerTest < ActionController::TestCase env.save! community.add_member(@profile) login_as(@profile.identifier) - get :profile_info, :profile => community.identifier, :block_id => block.id + get :index, :profile => community.identifier assert_no_match /\/contact\/#{community.identifier}\/new/, @response.body end -- libgit2 0.21.2