Created
May 17, 2010 13:00
-
-
Save meineerde/403728 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Index: app/controllers/my_controller.rb | |
| =================================================================== | |
| --- app/controllers/my_controller.rb (revision 3739) | |
| +++ app/controllers/my_controller.rb (working copy) | |
| @@ -136,7 +136,7 @@ | |
| 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] || {} | |
| + layout = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup | |
| # remove if already present in a group | |
| %w(top left right).each {|f| (layout[f] ||= []).delete block } | |
| # add it on top | |
| @@ -152,7 +152,7 @@ | |
| block = params[:block].to_s.underscore | |
| @user = User.current | |
| # remove block in all groups | |
| - layout = @user.pref[:my_page_layout] || {} | |
| + layout = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup | |
| %w(top left right).each {|f| (layout[f] ||= []).delete block } | |
| @user.pref[:my_page_layout] = layout | |
| @user.pref.save | |
| @@ -168,7 +168,7 @@ | |
| if group.is_a?(String) | |
| group_items = (params["list-#{group}"] || []).collect(&:underscore) | |
| if group_items and group_items.is_a? Array | |
| - layout = @user.pref[:my_page_layout] || {} | |
| + layout = @user.pref[:my_page_layout] || DEFAULT_LAYOUT.dup | |
| # remove group blocks if they are presents in other groups | |
| %w(top left right).each {|f| | |
| layout[f] = (layout[f] || []) - group_items |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment