From 1bcdb1dc0045eaaa26fa7afc53f99db7d967bc11 Mon Sep 17 00:00:00 2001 From: AntonioTerceiro Date: Sat, 9 Feb 2008 20:04:31 +0000 Subject: [PATCH] ActionItem154: updating the block types used for profiles and environments --- app/controllers/admin/environment_design_controller.rb | 2 +- app/controllers/my_profile/profile_design_controller.rb | 8 +++++++- test/functional/profile_design_controller_test.rb | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/controllers/admin/environment_design_controller.rb b/app/controllers/admin/environment_design_controller.rb index c5d21ec..3ca1864 100644 --- a/app/controllers/admin/environment_design_controller.rb +++ b/app/controllers/admin/environment_design_controller.rb @@ -1,7 +1,7 @@ class EnvironmentDesignController < BoxOrganizerController def available_blocks - @available_blocks ||= [ LoginBlock, EnvironmentStatisticsBlock, RecentDocumentsBlock ] + @available_blocks ||= [ LoginBlock, EnvironmentStatisticsBlock, RecentDocumentsBlock, ProfileListBlock ] end end diff --git a/app/controllers/my_profile/profile_design_controller.rb b/app/controllers/my_profile/profile_design_controller.rb index 51c00d0..50a6cd7 100644 --- a/app/controllers/my_profile/profile_design_controller.rb +++ b/app/controllers/my_profile/profile_design_controller.rb @@ -3,7 +3,13 @@ class ProfileDesignController < BoxOrganizerController needs_profile def available_blocks - @available_blocks ||= [ Block, ArticleBlock, TagsBlock, RecentDocumentsBlock, ProfileInfoBlock ] + blocks = [ ArticleBlock, TagsBlock, RecentDocumentsBlock, ProfileInfoBlock, TagsBlock ] + + if profile.has_members? + blocks << MembersBlock + end + + blocks end end diff --git a/test/functional/profile_design_controller_test.rb b/test/functional/profile_design_controller_test.rb index 462e197..1b32b1d 100644 --- a/test/functional/profile_design_controller_test.rb +++ b/test/functional/profile_design_controller_test.rb @@ -150,12 +150,12 @@ class ProfileDesignControllerTest < Test::Unit::TestCase should 'actually add a new block' do assert_difference Block, :count do - post :add_block, :profile => 'ze', :box_id => 1, :type => Block.name + post :add_block, :profile => 'ze', :box_id => 1, :type => RecentDocumentsBlock.name assert_redirected_to :action => 'index' end end - should 'not allow tp create unknown types' do + should 'not allow to create unknown types' do assert_no_difference Block, :count do assert_raise ArgumentError do post :add_block, :profile => 'ze', :box_id => 1, :type => "PleaseLetMeCrackYourSite" -- libgit2 0.21.2