Mercurial > hg > soundsoftware-site
comparison app/controllers/my_controller.rb @ 1294:3e4c3460b6ca redmine-2.2
Update to Redmine SVN revision 11972 on 2.2-stable branch
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:01:12 +0100 |
parents | 433d4f72a19b |
children | 622f24f53b42 0a574315af3e 261b3d9a4903 |
comparison
equal
deleted
inserted
replaced
1115:433d4f72a19b | 1294:3e4c3460b6ca |
---|---|
145 # Add a block to user's page | 145 # Add a block to user's page |
146 # The block is added on top of the page | 146 # The block is added on top of the page |
147 # params[:block] : id of the block to add | 147 # params[:block] : id of the block to add |
148 def add_block | 148 def add_block |
149 block = params[:block].to_s.underscore | 149 block = params[:block].to_s.underscore |
150 (render :nothing => true; return) unless block && (BLOCKS.keys.include? block) | 150 if block.present? && BLOCKS.key?(block) |
151 @user = User.current | 151 @user = User.current |
152 layout = @user.pref[:my_page_layout] || {} | 152 layout = @user.pref[:my_page_layout] || {} |
153 # remove if already present in a group | 153 # remove if already present in a group |
154 %w(top left right).each {|f| (layout[f] ||= []).delete block } | 154 %w(top left right).each {|f| (layout[f] ||= []).delete block } |
155 # add it on top | 155 # add it on top |
156 layout['top'].unshift block | 156 layout['top'].unshift block |
157 @user.pref[:my_page_layout] = layout | 157 @user.pref[:my_page_layout] = layout |
158 @user.pref.save | 158 @user.pref.save |
159 end | |
159 redirect_to :action => 'page_layout' | 160 redirect_to :action => 'page_layout' |
160 end | 161 end |
161 | 162 |
162 # Remove a block to user's page | 163 # Remove a block to user's page |
163 # params[:block] : id of the block to remove | 164 # params[:block] : id of the block to remove |