diff --git a/app/controllers/box_organizer_controller.rb b/app/controllers/box_organizer_controller.rb index fb37c42..4add4bc 100644 --- a/app/controllers/box_organizer_controller.rb +++ b/app/controllers/box_organizer_controller.rb @@ -99,6 +99,12 @@ class BoxOrganizerController < ApplicationController end end + def clone_block + block = Block.find(params[:id]) + block.duplicate + redirect_to :action => 'index' + end + protected :boxes_editor? end diff --git a/app/controllers/my_profile/profile_design_controller.rb b/app/controllers/my_profile/profile_design_controller.rb index 69c2a31..8fb5245 100644 --- a/app/controllers/my_profile/profile_design_controller.rb +++ b/app/controllers/my_profile/profile_design_controller.rb @@ -55,10 +55,4 @@ class ProfileDesignController < BoxOrganizerController blocks end - def clone - block = Block.find(params[:id]) - block.duplicate - redirect_to :action => 'index' - end - end diff --git a/app/helpers/boxes_helper.rb b/app/helpers/boxes_helper.rb index 8045453..fa231c5 100644 --- a/app/helpers/boxes_helper.rb +++ b/app/helpers/boxes_helper.rb @@ -212,7 +212,7 @@ module BoxesHelper if !block.main? buttons << icon_button(:delete, _('Remove block'), { :action => 'remove', :id => block.id }, { :method => 'post', :confirm => _('Are you sure you want to remove this block?')}) - buttons << icon_button(:clone, _('Clone'), { :action => 'clone', :id => block.id }, { :method => 'post' }) + buttons << icon_button(:clone, _('Clone'), { :action => 'clone_block', :id => block.id }, { :method => 'post' }) end if block.respond_to?(:help) diff --git a/test/functional/environment_design_controller_test.rb b/test/functional/environment_design_controller_test.rb index e0828ec..bbc159e 100644 --- a/test/functional/environment_design_controller_test.rb +++ b/test/functional/environment_design_controller_test.rb @@ -370,4 +370,13 @@ class EnvironmentDesignControllerTest < ActionController::TestCase assert @controller.instance_variable_get('@side_block_types').include?(CustomBlock8) end + should 'clone a block' do + login_as(create_admin_user(Environment.default)) + block = TagsBlock.create! + assert_difference TagsBlock, :count, 1 do + post :clone_block, :id => block.id + assert_response :redirect + end + end + end diff --git a/test/functional/profile_design_controller_test.rb b/test/functional/profile_design_controller_test.rb index a658bee..173b613 100644 --- a/test/functional/profile_design_controller_test.rb +++ b/test/functional/profile_design_controller_test.rb @@ -739,7 +739,7 @@ class ProfileDesignControllerTest < ActionController::TestCase should 'clone a block' do block = ProfileImageBlock.create!(:box => profile.boxes.first) assert_difference ProfileImageBlock, :count, 1 do - post :clone, :id => block.id, :profile => profile.identifier + post :clone_block, :id => block.id, :profile => profile.identifier assert_response :redirect end end -- libgit2 0.21.2