diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-01-20 15:56:46 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2013-01-20 15:56:46 +0000 |
commit | 6e6ce7c08595fbc2b1562d89099a6d6bad769cd5 (patch) | |
tree | b01d3eebe740cafa1ed8ee0d959950b7a0873709 /app/controllers/my_controller.rb | |
parent | 8b23d41cf92e7d9304b61a91dbd8da2e9f77987d (diff) | |
download | redmine-6e6ce7c08595fbc2b1562d89099a6d6bad769cd5.tar.gz redmine-6e6ce7c08595fbc2b1562d89099a6d6bad769cd5.zip |
Fixed that adding a blank/invalid block to my page renders a blank page (#12838).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11225 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/controllers/my_controller.rb')
-rw-r--r-- | app/controllers/my_controller.rb | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/app/controllers/my_controller.rb b/app/controllers/my_controller.rb index ab7b1828e..84f5b20ca 100644 --- a/app/controllers/my_controller.rb +++ b/app/controllers/my_controller.rb @@ -147,15 +147,16 @@ class MyController < ApplicationController # params[:block] : id of the block to add def add_block block = params[:block].to_s.underscore - (render :nothing => true; return) unless block && (BLOCKS.keys.include? block) - @user = User.current - layout = @user.pref[:my_page_layout] || {} - # remove if already present in a group - %w(top left right).each {|f| (layout[f] ||= []).delete block } - # add it on top - layout['top'].unshift block - @user.pref[:my_page_layout] = layout - @user.pref.save + if block.present? && BLOCKS.key?(block) + @user = User.current + layout = @user.pref[:my_page_layout] || {} + # remove if already present in a group + %w(top left right).each {|f| (layout[f] ||= []).delete block } + # add it on top + layout['top'].unshift block + @user.pref[:my_page_layout] = layout + @user.pref.save + end redirect_to my_page_layout_path end |