fixed: error when clicking "add" with no block selected on my/page_layout

git-svn-id: http://redmine.rubyforge.org/svn/trunk@261 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2007-02-18 20:20:17 +00:00
parent c9ed3fdae3
commit 4f2d74e25f
2 changed files with 10 additions and 4 deletions

View File

@@ -90,8 +90,9 @@ class MyController < ApplicationController
# The block is added on top of the page
# params[:block] : id of the block to add
def add_block
@user = self.logged_in_user
block = params[:block]
render(:nothing => true) and return unless block && (BLOCKS.keys.include? block)
@user = self.logged_in_user
# remove if already present in a group
%w(top left right).each {|f| (session[:page_layout][f] ||= []).delete block }
# add it on top