Commit 1bcdb1dc0045eaaa26fa7afc53f99db7d967bc11
1 parent
6f7fdaf9
Exists in
master
and in
29 other branches
ActionItem154: updating the block types used for profiles and environments
git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@1343 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing
3 changed files
with
10 additions
and
4 deletions
Show diff stats
app/controllers/admin/environment_design_controller.rb
| 1 | 1 | class EnvironmentDesignController < BoxOrganizerController |
| 2 | 2 | |
| 3 | 3 | def available_blocks |
| 4 | - @available_blocks ||= [ LoginBlock, EnvironmentStatisticsBlock, RecentDocumentsBlock ] | |
| 4 | + @available_blocks ||= [ LoginBlock, EnvironmentStatisticsBlock, RecentDocumentsBlock, ProfileListBlock ] | |
| 5 | 5 | end |
| 6 | 6 | |
| 7 | 7 | end | ... | ... |
app/controllers/my_profile/profile_design_controller.rb
| ... | ... | @@ -3,7 +3,13 @@ class ProfileDesignController < BoxOrganizerController |
| 3 | 3 | needs_profile |
| 4 | 4 | |
| 5 | 5 | def available_blocks |
| 6 | - @available_blocks ||= [ Block, ArticleBlock, TagsBlock, RecentDocumentsBlock, ProfileInfoBlock ] | |
| 6 | + blocks = [ ArticleBlock, TagsBlock, RecentDocumentsBlock, ProfileInfoBlock, TagsBlock ] | |
| 7 | + | |
| 8 | + if profile.has_members? | |
| 9 | + blocks << MembersBlock | |
| 10 | + end | |
| 11 | + | |
| 12 | + blocks | |
| 7 | 13 | end |
| 8 | 14 | |
| 9 | 15 | end | ... | ... |
test/functional/profile_design_controller_test.rb
| ... | ... | @@ -150,12 +150,12 @@ class ProfileDesignControllerTest < Test::Unit::TestCase |
| 150 | 150 | |
| 151 | 151 | should 'actually add a new block' do |
| 152 | 152 | assert_difference Block, :count do |
| 153 | - post :add_block, :profile => 'ze', :box_id => 1, :type => Block.name | |
| 153 | + post :add_block, :profile => 'ze', :box_id => 1, :type => RecentDocumentsBlock.name | |
| 154 | 154 | assert_redirected_to :action => 'index' |
| 155 | 155 | end |
| 156 | 156 | end |
| 157 | 157 | |
| 158 | - should 'not allow tp create unknown types' do | |
| 158 | + should 'not allow to create unknown types' do | |
| 159 | 159 | assert_no_difference Block, :count do |
| 160 | 160 | assert_raise ArgumentError do |
| 161 | 161 | post :add_block, :profile => 'ze', :box_id => 1, :type => "PleaseLetMeCrackYourSite" | ... | ... |